diff mbox

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

Message ID 20170824231532.16002-1-michael@niedermayer.cc
State Accepted
Commit 7e80b63ecd259d69d383623e75b318bf2bd491f6
Headers show

Commit Message

Michael Niedermayer Aug. 24, 2017, 11:15 p.m. UTC
From: 孙浩 and 张洪亮(望初) <tony.sh and wangchu.zhl@alibaba-inc.com>

Fixes: loop.cine

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

Comments

Michael Niedermayer Aug. 27, 2017, 5:13 p.m. UTC | #1
On Fri, Aug 25, 2017 at 01:15:27AM +0200, Michael Niedermayer wrote:
> From: 孙浩 and 张洪亮(望初) <tony.sh and wangchu.zhl@alibaba-inc.com>
> 
> Fixes: loop.cine
> 
> Found-by: Xiaohei and Wangchu from Alibaba Security Team
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/cinedec.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

applied

[...]
diff mbox

Patch

diff --git a/libavformat/cinedec.c b/libavformat/cinedec.c
index 763b93ba2e..de34fb9638 100644
--- a/libavformat/cinedec.c
+++ b/libavformat/cinedec.c
@@ -267,8 +267,12 @@  static int cine_read_header(AVFormatContext *avctx)
 
     /* parse image offsets */
     avio_seek(pb, offImageOffsets, SEEK_SET);
-    for (i = 0; i < st->duration; i++)
+    for (i = 0; i < st->duration; i++) {
+        if (avio_feof(pb))
+            return AVERROR_INVALIDDATA;
+
         av_add_index_entry(st, avio_rl64(pb), i, 0, 0, AVINDEX_KEYFRAME);
+    }
 
     return 0;
 }