mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-21 23:10:13 +00:00
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>
This commit is contained in:
parent
2a5fb0b13e
commit
ac480cb58d
@ -460,8 +460,11 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext
|
|||||||
av_free(st->codec->extradata);
|
av_free(st->codec->extradata);
|
||||||
if (ff_alloc_extradata(st->codec, len))
|
if (ff_alloc_extradata(st->codec, len))
|
||||||
return AVERROR(ENOMEM);
|
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;
|
return ret < 0 ? ret : AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
if (st->codec->codec_id == AV_CODEC_ID_AAC) {
|
if (st->codec->codec_id == AV_CODEC_ID_AAC) {
|
||||||
MPEG4AudioConfig cfg = {0};
|
MPEG4AudioConfig cfg = {0};
|
||||||
avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
|
avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
|
||||||
|
Loading…
Reference in New Issue
Block a user