4xmdec: fix integer overflow, null ptr dereference
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 20 Nov 2012 01:59:55 +0000 (02:59 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 20 Nov 2012 02:00:22 +0000 (03:00 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/4xm.c

index bd70692..bf0241a 100644 (file)
@@ -428,7 +428,7 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
         bytestream_size = FFMAX(length - bitstream_size - wordstream_size, 0);
     }
 
-    if (bitstream_size > length ||
+    if (bitstream_size > length || bitstream_size >= INT_MAX/8 ||
         bytestream_size > length - bitstream_size ||
         wordstream_size > length - bytestream_size - bitstream_size ||
         extra > length - bytestream_size - bitstream_size - wordstream_size) {