shithub: opus-tools

Download patch

ref: 0bb560ed40bf3475be7eee1fa751699494ae6db8
parent: ae6e94bbad4e2e3237bd8b6706509b0d0cf39b88
author: Timothy B. Terriberry <tterribe@xiph.org>
date: Thu Nov 28 03:02:34 EST 2013

Fix copying pictures from FLAC with a mimetype.

If the METADATA_BLOCK_PICTURE field contained a non-empty mimetype
 or description field, then we would overwrite important pieces of
 the struct when encoding, making the tag useless.

--- a/src/flac.c
+++ b/src/flac.c
@@ -207,11 +207,11 @@
         offs+=4;
         WRITE_U32_BE(buf+offs,(FLAC__uint32)mime_type_length);
         offs+=4;
-        memcpy(buf,metadata->data.picture.mime_type,mime_type_length);
+        memcpy(buf+offs,metadata->data.picture.mime_type,mime_type_length);
         offs+=mime_type_length;
         WRITE_U32_BE(buf+offs,(FLAC__uint32)description_length);
         offs+=4;
-        memcpy(buf,metadata->data.picture.description,description_length);
+        memcpy(buf+offs,metadata->data.picture.description,description_length);
         offs+=description_length;
         WRITE_U32_BE(buf+offs,metadata->data.picture.width);
         offs+=4;