wavpack: check the blocks sample count, fix out of array accesses
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 13 Nov 2012 00:12:26 +0000 (01:12 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 13 Nov 2012 00:13:07 +0000 (01:13 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/wavpack.c

index b36fa0a..bc038a9 100644 (file)
@@ -806,6 +806,10 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
             *got_frame_ptr = 0;
             return 0;
         }
+        if (s->samples > wc->samples) {
+            av_log(avctx, AV_LOG_ERROR, "too many samples in block");
+            return -1;
+        }
     } else {
         s->samples = wc->samples;
     }