summaryrefslogtreecommitdiff
path: root/libavformat/nsvdec.c
diff options
context:
space:
mode:
author孙浩(晓黑) <tony.sh@alibaba-inc.com>2017-08-29 23:59:21 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-09-01 01:48:31 +0200
commitc24bcb553650b91e9eff15ef6e54ca73de2453b7 (patch)
tree776d8b6951231f27f6a9581e118f18239b94faeb /libavformat/nsvdec.c
parent73bed07373f2672275e33851ad31e447b73b08f9 (diff)
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>
Diffstat (limited to 'libavformat/nsvdec.c')
-rw-r--r--libavformat/nsvdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index c6ddb67bbd..d8ce656817 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -335,8 +335,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')) {