OSDN Git Service

on2avc: check number of channels
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 4 Oct 2014 20:15:07 +0000 (22:15 +0200)
committerAnton Khirnov <anton@khirnov.net>
Fri, 19 Dec 2014 07:01:47 +0000 (08:01 +0100)
Fixes invalid memory access.

CC: libav-stable@libav.org
Bug-ID: CVE-2014-8549
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavcodec/on2avc.c

index deaa2b4..c00339f 100644 (file)
@@ -918,6 +918,10 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "0x500 version should be mono\n");
         return AVERROR_INVALIDDATA;
     }
+    if (avctx->channels > 2) {
+        av_log(avctx, AV_LOG_ERROR, "Only 1 or 2 channels are supported.\n");
+        return AVERROR(EINVAL);
+    }
     if (avctx->channels == 2)
         av_log(avctx, AV_LOG_WARNING,
                "Stereo mode support is not good, patch is welcome\n");