]> git.sesse.net Git - ffmpeg/commitdiff
Check for out of bound reads in the Electronic Arts CMV decoder.
authorLaurent Aimar <fenrir@videolan.org>
Fri, 30 Sep 2011 22:45:01 +0000 (00:45 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 1 Oct 2011 00:41:40 +0000 (02:41 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/eacmv.c

index 3ac9cdaecbe25651b71ab4355689c0e1353e1e69..20ec0a22652e512f02e2514daa27db4cdc3ba8fd 100644 (file)
@@ -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;