diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2009-07-03 11:27:52 +0000 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2009-07-03 11:27:52 +0000 |
commit | 3dcddf82edeb79a51a030191be6d4e816556c8ef (patch) | |
tree | 1fcc4c3fa50968bb273b18c2a055006c60ab7e16 /libavformat/avidec.c | |
parent | 5a4a4d78396d4195e14fbc4ba6bb3f996edecdf6 (diff) | |
download | ffmpeg-3dcddf82edeb79a51a030191be6d4e816556c8ef.tar.gz |
Check for failed extradata malloc, fixes a crash in out-of-memory conditions
or with extremely large extradata.
Originally committed as revision 19333 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r-- | libavformat/avidec.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 5b7c8bb059..56b6204e04 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -483,6 +483,10 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) 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); } |