aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author孙浩 and 张洪亮(望初) <tony.sh and wangchu.zhl@alibaba-inc.com>2017-08-25 12:37:25 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-09-17 12:21:32 +0200
commitf94517934bf0ff2510f472fa2bc4cd362951109c (patch)
tree28f2c02ccf42548652bbd81eebd3f1ff68a02d76
parent2920c7cec0b1958b59e5e7990078bea4428f6912 (diff)
downloadffmpeg-f94517934bf0ff2510f472fa2bc4cd362951109c.tar.gz
avformat/asfdec: Fix DoS due to lack of eof check
Fixes: loop.asf Found-by: Xiaohei and Wangchu from Alibaba Security Team Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 7f9ec5593e04827249e7aeb466da06a98a0d7329) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/asfdec_f.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index b973eff96e..2cacafe50d 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -749,13 +749,15 @@ static int asf_read_marker(AVFormatContext *s, int64_t size)
count = avio_rl32(pb); // markers count
avio_rl16(pb); // reserved 2 bytes
name_len = avio_rl16(pb); // name length
- for (i = 0; i < name_len; i++)
- avio_r8(pb); // skip the name
+ avio_skip(pb, name_len);
for (i = 0; i < count; i++) {
int64_t pres_time;
int name_len;
+ if (avio_feof(pb))
+ return AVERROR_INVALIDDATA;
+
avio_rl64(pb); // offset, 8 bytes
pres_time = avio_rl64(pb); // presentation time
pres_time -= asf->hdr.preroll * 10000;