OSDN Git Service

avcodec/interplayvideo: Check that enough data is available for opcode_0xA
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 18 Dec 2013 23:17:12 +0000 (00:17 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 18 Dec 2013 23:38:11 +0000 (00:38 +0100)
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f90e5be6b30_3965_baldursgate_camp.mve
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/interplayvideo.c

index 7ac1456..71f89ab 100644 (file)
@@ -374,6 +374,11 @@ static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s, AVFrame *frame)
     unsigned char P[8];
     int flags = 0;
 
+    if (bytestream2_get_bytes_left(&s->stream_ptr) < 16) {
+        av_log(s->avctx, AV_LOG_ERROR, "too little data for opcode 0xA\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     bytestream2_get_buffer(&s->stream_ptr, P, 4);
 
     /* 4-color encoding for each 4x4 quadrant, or 4-color encoding on