avcodec/atrac9dec: Check block_align
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 18 Aug 2019 23:03:59 +0000 (01:03 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 27 Aug 2019 15:57:44 +0000 (17:57 +0200)
Fixes: Infinite loop
Fixes: 16260/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5676365617037312
Fixes: 16260/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5768093879500800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/atrac9dec.c

index 4ea6ff0f315653ef93ee6834611ed65f7459eb7b..46e60ca998b56b60233af2f54dd891fff3910d4f 100644 (file)
@@ -839,6 +839,11 @@ static av_cold int atrac9_decode_init(AVCodecContext *avctx)
 
     av_lfg_init(&s->lfg, 0xFBADF00D);
 
+    if (avctx->block_align <= 0) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid block align\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     if (avctx->extradata_size != 12) {
         av_log(avctx, AV_LOG_ERROR, "Invalid extradata length!\n");
         return AVERROR_INVALIDDATA;