1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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

View File

@ -338,6 +338,11 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR(EINVAL); 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; n = avctx->channels * sample_size;
if (n && buf_size % n) { if (n && buf_size % n) {