aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-31 09:31:22 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commitf640a2d9a97e94e0f5652905c405430f3dd0bc33 (patch)
tree1cb92be4af0de2bebf759aa3bca9ab267aba54a3
parent313bdb49a640e8d02cf55ee0a560c04ca0e0d172 (diff)
downloadffmpeg-f640a2d9a97e94e0f5652905c405430f3dd0bc33.tar.gz
avcodec/utils: Check block_align
Fixes: out of array access Fixes: 18432/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV2_fuzzer-5675574936207360 Fixes: 18326/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV2_fuzzer-5071752362721280 Fixes: 18384/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV1_fuzzer-5769439500304384 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> (cherry picked from commit f011572e66c8dd2f0ac3cb147a769e91f24e0202) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/utils.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 2c1b7fdd52..8f19237d3f 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1381,6 +1381,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
ret = AVERROR(EINVAL);
goto free_and_end;
}
+ if (avctx->block_align < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid block align: %d\n", avctx->block_align);
+ ret = AVERROR(EINVAL);
+ goto free_and_end;
+ }
avctx->codec = codec;
if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&