diff options
author | 孙浩(晓黑) <tony.sh@alibaba-inc.com> | 2017-08-29 23:59:21 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-09-01 03:03:47 +0200 |
commit | 4fedc4ceabe32bb3bea68ab71cb42f0b6e409586 (patch) | |
tree | 1a17886f1642e980f71499365168401e5ce8ca14 | |
parent | 09a1d15de7942c32d1e17381c6ca8cc41e236afb (diff) | |
download | ffmpeg-4fedc4ceabe32bb3bea68ab71cb42f0b6e409586.tar.gz |
avformat/nsvdec: Fix DoS due to lack of eof check in nsvs_file_offset loop.
Fixes: 20170829.nsv
Co-Author: 张洪亮(望初)" <wangchu.zhl@alibaba-inc.com>
Found-by: Xiaohei and Wangchu from Alibaba Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c24bcb553650b91e9eff15ef6e54ca73de2453b7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/nsvdec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 05dfd539e4..fb36cace0d 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -350,8 +350,11 @@ static int nsv_parse_NSVf_header(AVFormatContext *s) if (!nsv->nsvs_file_offset) return AVERROR(ENOMEM); - for(i=0;i<table_entries_used;i++) + for(i=0;i<table_entries_used;i++) { + if (avio_feof(pb)) + return AVERROR_INVALIDDATA; nsv->nsvs_file_offset[i] = avio_rl32(pb) + size; + } if(table_entries > table_entries_used && avio_rl32(pb) == MKTAG('T','O','C','2')) { |