summaryrefslogtreecommitdiff
path: root/libavcodec/adpcm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-15 22:09:10 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-10-20 15:33:13 +0200
commit4ebe40ef6418995a888094f680eb2313850618d4 (patch)
tree9970b4411937912555d83d5c70e164ffff4e38e4 /libavcodec/adpcm.c
parenta4895b75a3030d624fd15793e830543b94a0f29c (diff)
downloadffmpeg-4ebe40ef6418995a888094f680eb2313850618d4.tar.gz
avcodec/adpcm: Check channels before use for ADPCM_PSX
Fixes: division by zero Fixes: 26293/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_PSX_fuzzer-5176665237618688 Fixes: 26331/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_PSX_fuzzer-5632330364092416 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/adpcm.c')
-rw-r--r--libavcodec/adpcm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index f7da3dcf89..d018c1f91b 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -135,7 +135,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
break;
case AV_CODEC_ID_ADPCM_PSX:
max_channels = 8;
- if (avctx->block_align % (16 * avctx->channels))
+ if (avctx->channels <= 0 || avctx->block_align % (16 * avctx->channels))
return AVERROR_INVALIDDATA;
break;
case AV_CODEC_ID_ADPCM_IMA_DAT4: