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

Reimar Döffinger Reimar.Doeffinger
Wed Jul 1 20:16:56 CEST 2009


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);
                     }
 



More information about the ffmpeg-devel mailing list