[FFmpeg-devel] [PATCH 08/12] Check for out of bound reads in the Electronic Arts CMV decoder.

fenrir at elivagar.org fenrir at elivagar.org
Sat Oct 1 00:45:01 CEST 2011


From: Laurent Aimar <fenrir at videolan.org>

---
 libavcodec/eacmv.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c
index 3ac9cda..20ec0a2 100644
--- a/libavcodec/eacmv.c
+++ b/libavcodec/eacmv.c
@@ -158,6 +158,9 @@ static int cmv_decode_frame(AVCodecContext *avctx,
     CmvContext *s = avctx->priv_data;
     const uint8_t *buf_end = buf + buf_size;
 
+    if (buf_end - buf < EA_PREAMBLE_SIZE)
+        return AVERROR_INVALIDDATA;
+
     if (AV_RL32(buf)==MVIh_TAG||AV_RB32(buf)==MVIh_TAG) {
         cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end);
         return buf_size;
-- 
1.7.2.5



More information about the ffmpeg-devel mailing list