[FFmpeg-devel,3/3] avcodec/atrac9dec: Check block_align

Submitted by Michael Niedermayer on Aug. 18, 2019, 11:30 p.m.

Details

Message ID 20190818233054.2069-3-michael@niedermayer.cc
State Accepted
Commit dead949a1fbf019647f5c8ea797d1c7be6615639
Headers show

Commit Message

Michael Niedermayer Aug. 18, 2019, 11:30 p.m.
Fixes: Infinite loop
Fixes: 16260/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5676365617037312

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 | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Michael Niedermayer Aug. 27, 2019, 3:58 p.m.
On Mon, Aug 19, 2019 at 01:30:54AM +0200, Michael Niedermayer wrote:
> Fixes: Infinite loop
> Fixes: 16260/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5676365617037312
> 
> 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 | 5 +++++
>  1 file changed, 5 insertions(+)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
index 4ea6ff0f31..46e60ca998 100644
--- a/libavcodec/atrac9dec.c
+++ b/libavcodec/atrac9dec.c
@@ -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;