diff options
author | 孙浩 and 张洪亮(望初) <tony.sh and wangchu.zhl@alibaba-inc.com> | 2017-08-25 12:37:25 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-08-28 01:42:03 +0200 |
commit | e7dc286b16ab54342e0b415abb4dc4e0cc22f736 (patch) | |
tree | 28cd25ef60d14ccdb54a4f5e68e750ce576316bb | |
parent | 7ba100d3e6e8b1e5d5342feb960a7f081d6e15af (diff) | |
download | ffmpeg-e7dc286b16ab54342e0b415abb4dc4e0cc22f736.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.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index c93395c9a5..b51862d8a0 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -694,13 +694,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; |