[FFmpeg-devel] [PATCH 2/2] avcodec/alac: Check decorr_shift to avoid invalid shift
Michael Niedermayer
michael at niedermayer.cc
Fri Jul 24 01:11:38 EEST 2020
Fixes: shift exponent 128 is too large for 32-bit type 'int'
Fixes: 23860/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5751138914402304
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/alac.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index bf05406230..9040673528 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -302,6 +302,9 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
decorr_shift = get_bits(&alac->gb, 8);
decorr_left_weight = get_bits(&alac->gb, 8);
+ if (channels == 2 && decorr_left_weight && decorr_shift > 31)
+ return AVERROR_INVALIDDATA;
+
for (ch = 0; ch < channels; ch++) {
prediction_type[ch] = get_bits(&alac->gb, 4);
lpc_quant[ch] = get_bits(&alac->gb, 4);
--
2.17.1
More information about the ffmpeg-devel
mailing list