diff mbox

[FFmpeg-devel,4/6] avformat/mvdec: Fix DoS due to lack of eof check

Message ID 20170824231532.16002-4-michael@niedermayer.cc
State Accepted
Commit 4f05e2e2dc1a89f38cd9f0960a6561083d714f1e
Headers show

Commit Message

Michael Niedermayer Aug. 24, 2017, 11:15 p.m. UTC
Fixes: loop.mv

Found-by: Xiaohei and Wangchu from Alibaba Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mvdec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Aug. 27, 2017, 5:13 p.m. UTC | #1
On Fri, Aug 25, 2017 at 01:15:30AM +0200, Michael Niedermayer wrote:
> Fixes: loop.mv
> 
> Found-by: Xiaohei and Wangchu from Alibaba Security Team
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mvdec.c | 2 ++
>  1 file changed, 2 insertions(+)

applied

[...]
diff mbox

Patch

diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index 0e12c8c6c1..f7aa4cbaec 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -342,6 +342,8 @@  static int mv_read_header(AVFormatContext *avctx)
             uint32_t pos   = avio_rb32(pb);
             uint32_t asize = avio_rb32(pb);
             uint32_t vsize = avio_rb32(pb);
+            if (avio_feof(pb))
+                return AVERROR_INVALIDDATA;
             avio_skip(pb, 8);
             av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME);
             av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME);