Skip to content
Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
孙浩 and 张洪亮(望初) authored and michaelni committed Aug 27, 2017
1 parent 7ec4148 commit 7f9ec55
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libavformat/asfdec_f.c
Expand Up @@ -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;
Expand Down

1 comment on commit 7f9ec55

@shqking
Copy link

@shqking shqking commented on 7f9ec55 Sep 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.