[FFmpeg-cvslog] avcodec/zmbv: Check len before reading in decode_frame()

Michael Niedermayer git at videolan.org
Thu Mar 12 18:05:40 CET 2015


ffmpeg | branch: release/0.10 | Michael Niedermayer <michaelni at gmx.at> | Wed Feb 25 12:29:10 2015 +0100| [0c1f8a784db9d60f30f838153f03e325437ec844] | committer: Michael Niedermayer

avcodec/zmbv: Check len before reading in decode_frame()

Fixes out of array read
Fixes: asan_heap-oob_4d4eb0_3994_cov_3169972261_zmbv_15bit.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 1f5c7781e63d6519192ada59c1e36bcecc92791d)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c1f8a784db9d60f30f838153f03e325437ec844
---

 libavcodec/zmbv.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index 38ab725..1ac7274 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -416,11 +416,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
     }
 
     /* parse header */
+    if (len < 1)
+        return AVERROR_INVALIDDATA;
     c->flags = buf[0];
     buf++; len--;
     if (c->flags & ZMBV_KEYFRAME) {
         void *decode_intra = NULL;
         c->decode_intra= NULL;
+
+        if (len < 6)
+            return AVERROR_INVALIDDATA;
         hi_ver = buf[0];
         lo_ver = buf[1];
         c->comp = buf[2];



More information about the ffmpeg-cvslog mailing list