From: Michael Niedermayer Date: Mon, 4 Sep 2017 22:16:29 +0000 (+0200) Subject: avformat/asfdec: Fix DoS in asf_build_simple_index() X-Git-Tag: archive/raspbian/6%11.12-1_deb8u8+rpi1^2~19 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=84d2c81bfdb403e1b3b62bf13f5fffdf01df4a77;p=libav.git 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 [sunweaver] - Backport to libav as found in Debian jessie LTS. Gbp-Pq: Name CVE-2017-14223.patch --- diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 1ec36aa..65cac31 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -1442,6 +1442,11 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index) int64_t pos = s->data_offset + s->packet_size * (int64_t)pktnum; int64_t index_pts = FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0); + if (avio_feof(s->pb)) { + ret = AVERROR_INVALIDDATA; + goto end; + } + if (pos != last_pos) { av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d pts: %"PRId64"\n", pktnum, pktct, index_pts);