diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-12-01 02:36:01 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-12-01 02:36:28 +0100 |
commit | f0695b09dd479e9f20e522417a46a6132c391a1c (patch) | |
tree | 1f23c76e667723c4498f794171fb8986407be8fd /libavcodec/pcm.c | |
parent | b90e795f737c5efb9f65869b304e87a0985b046d (diff) | |
download | ffmpeg-f0695b09dd479e9f20e522417a46a6132c391a1c.tar.gz |
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>
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r-- | libavcodec/pcm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 5ed603ee3f..d769fb1e38 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -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) { |