mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-01 18:21:04 +00:00
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 c24bcb5536
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
09a1d15de7
commit
4fedc4ceab
@ -350,8 +350,11 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
|
|||||||
if (!nsv->nsvs_file_offset)
|
if (!nsv->nsvs_file_offset)
|
||||||
return AVERROR(ENOMEM);
|
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;
|
nsv->nsvs_file_offset[i] = avio_rl32(pb) + size;
|
||||||
|
}
|
||||||
|
|
||||||
if(table_entries > table_entries_used &&
|
if(table_entries > table_entries_used &&
|
||||||
avio_rl32(pb) == MKTAG('T','O','C','2')) {
|
avio_rl32(pb) == MKTAG('T','O','C','2')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user