Skip to content

Commit afc9c68

Browse files
committed
avformat/asfdec: Fix DoS in asf_build_simple_index()
Fixes: Missing EOF check in loop No testcase Found-by: Xiaohei and Wangchu from Alibaba Security Team Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
1 parent 9cb4eb7 commit afc9c68

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: libavformat/asfdec_f.c

+5
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,11 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index)
16101610
int64_t pos = s->internal->data_offset + s->packet_size * (int64_t)pktnum;
16111611
int64_t index_pts = FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);
16121612

1613+
if (avio_feof(s->pb)) {
1614+
ret = AVERROR_INVALIDDATA;
1615+
goto end;
1616+
}
1617+
16131618
if (pos != last_pos) {
16141619
av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d pts: %"PRId64"\n",
16151620
pktnum, pktct, index_pts);

0 commit comments

Comments
 (0)