[FFmpeg-cvslog] pcmdec: check codec_id

Michael Niedermayer git at videolan.org
Sat Dec 1 04:09:36 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Dec  1 02:36:01 2012 +0100| [f0695b09dd479e9f20e522417a46a6132c391a1c] | committer: Michael Niedermayer

pcmdec: check codec_id

Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0695b09dd479e9f20e522417a46a6132c391a1c
---

 libavcodec/pcm.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 5ed603e..d769fb1 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) {



More information about the ffmpeg-cvslog mailing list