aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-19 01:04:07 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:11:55 +0200
commit345a3b8edf43c4f6fd979f61a47afcb8a671905e (patch)
treeca8471c8d8723a0da0fb1c2cf976b70ba0319a24
parentbf0af79cbcd713a503a24dc0c1f4e35a410252f1 (diff)
downloadffmpeg-345a3b8edf43c4f6fd979f61a47afcb8a671905e.tar.gz
avcodec/alac: Check lpc_quant
lpc_quant of 0 produces undefined behavior, thus disallow this. If valid samples use this then such a sample would be quite usefull to confirm the correct&lossles handling of this. Fixes: libavcodec/alac.c:218:25: runtime error: shift exponent -1 is negative Fixes: 15273/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5656388535058432 Fixes: 15276/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5761238417539072 Fixes: 15315/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5767260766994432 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit a6474b899c1153e3bb95e399b6605c3507aea0d0) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/alac.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index b9c34009a5..07aae882ca 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -305,7 +305,7 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
rice_history_mult[ch] = get_bits(&alac->gb, 3);
lpc_order[ch] = get_bits(&alac->gb, 5);
- if (lpc_order[ch] >= alac->max_samples_per_frame)
+ if (lpc_order[ch] >= alac->max_samples_per_frame || !lpc_quant[ch])
return AVERROR_INVALIDDATA;
/* read the predictor table */