iff: avoid out of array reads, due to too many planes.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Nov 2012 16:47:51 +0000 (17:47 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Nov 2012 16:47:51 +0000 (17:47 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/iff.c

index bc88a8e..d5c1457 100644 (file)
@@ -371,6 +371,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
 static void decodeplane8(uint8_t *dst, const uint8_t *buf, int buf_size, int plane)
 {
     const uint64_t *lut = plane8_lut[plane];
+    if (plane >= 8) {
+        av_log(0, AV_LOG_WARNING, "Ignoring extra planes beyond 8\n");
+        return;
+    }
     do {
         uint64_t v = AV_RN64A(dst) | lut[*buf++];
         AV_WN64A(dst, v);