aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-09-05 00:16:29 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-09-08 18:37:43 +0200
commitf8c52dfa1583f0d2c039bad8c9422d2fd190a039 (patch)
tree9aaa4eb7fa02db3a10ac970b8c9a779d7a31270c
parenta17e1abf6e4dbf6a6cb3b81a77582834dcd27071 (diff)
downloadffmpeg-f8c52dfa1583f0d2c039bad8c9422d2fd190a039.tar.gz
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> (cherry picked from commit afc9c683ed9db01edb357bc8c19edad4282b3a97) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/asfdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index b51862d8a0..94892328aa 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1526,6 +1526,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);