Commit f0695b09 authored by Michael Niedermayer's avatar Michael Niedermayer

pcmdec: check codec_id

Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent b90e795f
...@@ -338,6 +338,11 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, ...@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment