[FFmpeg-devel] [PATCH] check for failed extradata malloc in avidec

Michael Niedermayer michaelni
Wed Jul 1 23:27:02 CEST 2009


On Wed, Jul 01, 2009 at 08:16:56PM +0200, Reimar D?ffinger wrote:
> Hello,
> this fixes one of the files in issue1240.
> Not sure if this is the best solution (the extradata size limit of 2^30 seems
> rather extreme) but anyway...
> Index: libavformat/avidec.c
> ===================================================================
> --- libavformat/avidec.c	(revision 19317)
> +++ libavformat/avidec.c	(working copy)
> @@ -478,6 +478,10 @@
>                      if(size > 10*4 && size<(1<<30)){
>                          st->codec->extradata_size= size - 10*4;
>                          st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
> +                        if (!st->codec->extradata) {
> +                            st->codec->extradata_size= 0;
> +                            return AVERROR(ENOMEM);
> +                        }
>                          get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
>                      }

hmm, id treat malloc failure like a too large extradata
also a error message could be usefull for both

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- 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/20090701/b66200b0/attachment.pgp>



More information about the ffmpeg-devel mailing list