wavpack: check the blocks sample count, fix out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-11-13 01:12:26 +01:00
parent 580021cfc4
commit d8a1eb11b7
1 changed files with 4 additions and 0 deletions

View File

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