aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-08-25 18:22:50 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commitf775712d67b1dffde16235be0be7b30d39000971 (patch)
tree705a56bef1c9842643ebca888a5c8e1361842be9
parenteccef3a6f9673897770c2622d5843e4ae43ee9d6 (diff)
downloadffmpeg-f775712d67b1dffde16235be0be7b30d39000971.tar.gz
avcodec/alsdec: Check k from being outside what our implementation can handle
The specification does not seem to list what the maximum valid value is Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int' Fixes: 16268/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5638164544225280 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 e1255789941d213a8e193469d0687946c9fa4a63) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/alsdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index d30ee8374e..042f554ff6 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -839,6 +839,9 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
k [sb] = s[sb] > b ? s[sb] - b : 0;
delta[sb] = 5 - s[sb] + k[sb];
+ if (k[sb] >= 32)
+ return AVERROR_INVALIDDATA;
+
ff_bgmc_decode(gb, sb_len, current_res,
delta[sb], sx[sb], &high, &low, &value, ctx->bgmc_lut, ctx->bgmc_lut_status);