aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/isom.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-12-21 12:52:23 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-12-22 01:48:33 +0100
commit2c635fabbf7ec8ed4f30d9b3c04d5c24cb7a081d (patch)
tree901ff8a4357e32f71fbf54bd40d42ab830a880bd /libavformat/isom.c
parentb797a00f634686b6a1752cbb55a7c95d361fa838 (diff)
downloadffmpeg-2c635fabbf7ec8ed4f30d9b3c04d5c24cb7a081d.tar.gz
avformat/isom: check avio_read() result
Fixes use of uninitialized memory Fixes: msan_uninit-mem_7f7aa4151661_4885_dmbts3.ts Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/isom.c')
-rw-r--r--libavformat/isom.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 19ec57b5df..8a85fe3568 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -438,6 +438,7 @@ static const AVCodecTag mp4_audio_types[] = {
int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb)
{
int len, tag;
+ int ret;
int object_type_id = avio_r8(pb);
avio_r8(pb); /* stream type */
avio_rb24(pb); /* buffer size db */
@@ -459,7 +460,8 @@ 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);
- avio_read(pb, st->codec->extradata, len);
+ if ((ret = avio_read(pb, st->codec->extradata, len)) != len)
+ 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,