diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-23 18:09:58 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-25 16:25:17 +0100 |
commit | ac480cb58dbe7859c96a08e9e5cd3dd3b0fb0ae7 (patch) | |
tree | ffcfeca8ab7e46e58e9b8e0005402ba81b845575 /libavformat | |
parent | 2a5fb0b13e218e6864825f8ff4ea7c6be21fb50b (diff) | |
download | ffmpeg-ac480cb58dbe7859c96a08e9e5cd3dd3b0fb0ae7.tar.gz |
avformat/isom: free extradata on failure to read it
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f607d80f661_6965_mov00003.mqv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/isom.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/isom.c b/libavformat/isom.c index 8a85fe3568..da789d618b 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -460,8 +460,11 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext av_free(st->codec->extradata); if (ff_alloc_extradata(st->codec, len)) return AVERROR(ENOMEM); - if ((ret = avio_read(pb, st->codec->extradata, len)) != len) + if ((ret = avio_read(pb, st->codec->extradata, len)) != len) { + av_freep(&st->codec->extradata); + st->codec->extradata_size = 0; return ret < 0 ? ret : AVERROR_INVALIDDATA; + } if (st->codec->codec_id == AV_CODEC_ID_AAC) { MPEG4AudioConfig cfg = {0}; avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata, |