[FFmpeg-cvslog] adpcm: ADPCM Electronic Arts has always two channels

Janne Grunau git at videolan.org
Mon Jun 4 12:51:31 CEST 2012


ffmpeg | branch: release/0.6 | Janne Grunau <janne-libav at jannau.net> | Thu Jan  5 20:50:55 2012 +0100| [15c819e23ff1820ab6e0ea71291f939e36b2efb3] | committer: Reinhard Tartler

adpcm: ADPCM Electronic Arts has always two channels

Fixes half of http://ffmpeg.org/trac/ffmpeg/ticket/794
Adresses CVE-2012-0852

(cherry picked from commit bb5b3940b08d8dad5b7e948e8f3b02cd2eb70716)

Conflicts:

	libavcodec/adpcm.c

Signed-off-by: Reinhard Tartler <siretart at tauware.de>
(cherry picked from commit b581580bd1cc8506befa65b0a5c9ae429240f21f)

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

 libavcodec/adpcm.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 68bd656..2cf2d20 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -678,17 +678,23 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
 static av_cold int adpcm_decode_init(AVCodecContext * avctx)
 {
     ADPCMContext *c = avctx->priv_data;
+    unsigned int min_channels = 1;
     unsigned int max_channels = 2;
 
     switch(avctx->codec->id) {
+    case CODEC_ID_ADPCM_EA:
+        min_channels = 2;
+        break;
     case CODEC_ID_ADPCM_EA_R1:
     case CODEC_ID_ADPCM_EA_R2:
     case CODEC_ID_ADPCM_EA_R3:
         max_channels = 6;
         break;
     }
-    if(avctx->channels > max_channels){
-        return -1;
+
+    if (avctx->channels < min_channels || avctx->channels > max_channels) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
+        return AVERROR(EINVAL);
     }
 
     switch(avctx->codec->id) {



More information about the ffmpeg-cvslog mailing list