]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/adpcm: Check number of channels for MTAF
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 23 Sep 2019 21:52:04 +0000 (23:52 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 24 Sep 2019 10:24:41 +0000 (12:24 +0200)
Fixes: out of array access
Fixes: 17608/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_MTAF_fuzzer-5074936267276288
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/adpcm.c

index fb126503d676b80537d1775d2fe7b8c686044868..7f2ebfc99d9ace9a23763d6b51aba457db1516c7 100644 (file)
@@ -111,6 +111,10 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
     case AV_CODEC_ID_ADPCM_MTAF:
         min_channels = 2;
         max_channels = 8;
+        if (avctx->channels & 1) {
+            avpriv_request_sample(avctx, "channel count %d\n", avctx->channels);
+            return AVERROR_PATCHWELCOME;
+        }
         break;
     case AV_CODEC_ID_ADPCM_PSX:
         max_channels = 8;