diff options
author | 孙浩 and 张洪亮(望初) <tony.sh and wangchu.zhl@alibaba-inc.com> | 2017-08-25 01:15:28 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-08-27 19:23:13 +0200 |
commit | 124eb202e70678539544f6268efc98131f19fa49 (patch) | |
tree | 5ebfdd6b01e8bc021d603bebf6727599c3a08330 | |
parent | 7e80b63ecd259d69d383623e75b318bf2bd491f6 (diff) | |
download | ffmpeg-streaming-124eb202e70678539544f6268efc98131f19fa49.zip ffmpeg-streaming-124eb202e70678539544f6268efc98131f19fa49.tar.gz |
avformat/rmdec: Fix DoS due to lack of eof check
Fixes: loop.ivr
Found-by: Xiaohei and Wangchu from Alibaba Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/rmdec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 178eaea..d6d7d9c 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -1223,8 +1223,11 @@ static int ivr_read_header(AVFormatContext *s) av_log(s, AV_LOG_DEBUG, "%s = '%s'\n", key, val); } else if (type == 4) { av_log(s, AV_LOG_DEBUG, "%s = '0x", key); - for (j = 0; j < len; j++) + for (j = 0; j < len; j++) { + if (avio_feof(pb)) + return AVERROR_INVALIDDATA; av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb)); + } av_log(s, AV_LOG_DEBUG, "'\n"); } else if (len == 4 && type == 3 && !strncmp(key, "StreamCount", tlen)) { nb_streams = value = avio_rb32(pb); |