Reimar Döffinger <[email protected]> added the comment:

On Mon, Sep 21, 2009 at 07:15:57AM +0000, Baptiste Coudurier wrote:
> Even more, it's fixed size, so if len is less than 31 you must skip the 
> remaining bytes, otherwise you break demuxing.

Ah, ok, then I tried again to fix something that's not broken.
I suggest this patch then (which in difference to the last passes make
test):
Index: libavformat/mov.c
===================================================================
--- libavformat/mov.c   (revision 19948)
+++ libavformat/mov.c   (working copy)
@@ -889,8 +889,13 @@

             get_buffer(pb, codec_name, 32); /* codec name, pascal string */
             if (codec_name[0] <= 31) {
-                memcpy(st->codec->codec_name, &codec_name[1],codec_name[0]);
-                st->codec->codec_name[codec_name[0]] = 0;
+                int i;
+                int pos = 0;
+                for (i = 0; i < codec_name[0] && pos < 
sizeof(st->codec->codec_name) - 3; i++) {
+                    uint8_t tmp;
+                    PUT_UTF8(codec_name[i], tmp, st->codec->codec_name[pos++] 
= tmp;)
+                }
+                st->codec->codec_name[pos] = 0;
             }

             st->codec->bits_per_coded_sample = get_be16(pb); /* depth */

_____________________________________________________
FFmpeg issue tracker <[email protected]>
<https://roundup.ffmpeg.org/roundup/ffmpeg/issue1398>
_____________________________________________________

Reply via email to