pcmdec: check codec_id

Fixes 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-12-01 02:36:01 +01:00
parent b90e795f73
commit f0695b09dd
1 changed files with 5 additions and 0 deletions

View File

@ -338,6 +338,11 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR(EINVAL);
}
if (avctx->codec_id != avctx->codec->id) {
av_log(avctx, AV_LOG_ERROR, "codec ids mismatch\n");
return AVERROR(EINVAL);
}
n = avctx->channels * sample_size;
if (n && buf_size % n) {