[FFmpeg-devel] [PATCH] mp4toannexb modification / improvement

Michael Niedermayer michaelni
Tue Jun 8 20:21:44 CEST 2010


On Tue, Jun 08, 2010 at 11:20:27AM +0200, Luca Abeni wrote:
> On 06/08/2010 01:42 AM, Michael Niedermayer wrote:
> [...]
>>>   ffmpeg.c |    7 ++++++-
>>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>> 2e0ec35d443d49e150d89ed25889353dabdf93dd  copy_extradata_3.diff
>>> Index: ffmpeg.c
>>> ===================================================================
>>> --- ffmpeg.c	(revision 23512)
>>> +++ ffmpeg.c	(working copy)
>>> @@ -2168,7 +2168,10 @@
>>>               }
>>>
>>>               codec->bit_rate = icodec->bit_rate;
>>> -            codec->extradata= icodec->extradata;
>>> +            codec->extradata= av_malloc(icodec->extradata_size);
>>
>> missing padding
>
> Ops... I knew I was going to miss something :)
> Hopefully fixed both the two issues (since I am allocating a buffer
> larger than extradata_size, and copying only extradata_size, bytes,
> I used av_mallocz() instead of av_malloc()... I hope it is the right
> thing to do).
>
>
> 			Thanks,
> 				Luca

>  ffmpeg.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> a95fb3c7299f59e8a293c69186bacd7cc52d3ed6  copy_extradata_4.diff
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 23521)
> +++ ffmpeg.c	(working copy)
> @@ -2168,7 +2168,10 @@
>              }
>  
>              codec->bit_rate = icodec->bit_rate;
> -            codec->extradata= icodec->extradata;
> +            codec->extradata= av_mallocz(icodec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
> +            if (!codec->extradata)
> +                goto fail;
> +            memcpy(codec->extradata, icodec->extradata, icodec->extradata_size);

while it is quite obscure but the + could overflow and lead to a
successfull allocation of a too small buffer

the patch is ok otherwise

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I wish the Xiph folks would stop pretending they've got something they
do not.  Somehow I fear this will remain a wish. -- M?ns Rullg?rd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100608/6d3d1caa/attachment.pgp>



More information about the ffmpeg-devel mailing list