[FFmpeg-cvslog] r20092 - trunk/libavformat/mov.c

Reimar Döffinger Reimar.Doeffinger
Wed Sep 30 20:24:30 CEST 2009


On Wed, Sep 30, 2009 at 11:08:08AM -0700, Baptiste Coudurier wrote:
> On 9/30/09 2:43 AM, reimar wrote:
> >Author: reimar
> >Date: Wed Sep 30 11:43:56 2009
> >New Revision: 20092
> >
> >Log:
> >Convert latin1 codec_name in mov to UTF-8, since all strings in FFmpeg
> >must be valid UTF-8.
> >
> >Modified:
> >    trunk/libavformat/mov.c
> >
> >Modified: trunk/libavformat/mov.c
> >==============================================================================
> >--- trunk/libavformat/mov.c	Wed Sep 30 07:49:18 2009	(r20091)
> >+++ trunk/libavformat/mov.c	Wed Sep 30 11:43:56 2009	(r20092)
> >@@ -909,8 +909,13 @@ static int mov_read_stsd(MOVContext *c,
> >
> >              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;)
> >+                }
> 
> Shouldn't the copy skip the size first byte ?

Obviously. Didn't notice when testing since that character was non-printable...



More information about the ffmpeg-cvslog mailing list