]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/wavpack: Do not allow the sample format to change between channels
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 3 Jun 2020 19:13:47 +0000 (21:13 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 4 Jun 2020 21:09:07 +0000 (23:09 +0200)
Fixes: out of array access
Fixes: 22692/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5678686190960640
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: David Bryant <david@wavpack.com>
Tested-by: David Bryant <david@wavpack.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/wavpack.c

index ead57063c844570a12f10c38b59a48841dc8824e..f77548e5a5537640e0b6d65a3bcc6f87cde34167 100644 (file)
@@ -1129,6 +1129,9 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
     else
         sample_fmt          = AV_SAMPLE_FMT_S32P;
 
+    if (wc->ch_offset && avctx->sample_fmt != sample_fmt)
+        return AVERROR_INVALIDDATA;
+
     bpp            = av_get_bytes_per_sample(sample_fmt);
     orig_bpp       = ((s->frame_flags & 0x03) + 1) << 3;
     multiblock     = (s->frame_flags & WV_SINGLE_BLOCK) != WV_SINGLE_BLOCK;