aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author孙浩 and 张洪亮(望初) <tony.sh and wangchu.zhl@alibaba-inc.com>2017-08-25 01:15:28 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-09-17 12:21:32 +0200
commit2bbef8ee271240ce4509b23fd33e35076715a39f (patch)
tree58f92ec9a203073b44cd06af6f20049704ad25ca
parent98e177c7288574b336d80618f4ec5d1f94243070 (diff)
downloadffmpeg-2bbef8ee271240ce4509b23fd33e35076715a39f.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> (cherry picked from commit 124eb202e70678539544f6268efc98131f19fa49) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/rmdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 4d565291af..7656812eb1 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -1238,8 +1238,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);