aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-02-09 00:23:14 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-03 12:10:24 +0200
commit2d7a83457e95dc938d19ca73839e7503df26b592 (patch)
tree373f6019c3dcd1c2b5687745ca4bfee7c526ca45
parent778965d30d3a6932ea48fd5bf9aca980d53f98da (diff)
downloadffmpeg-2d7a83457e95dc938d19ca73839e7503df26b592.tar.gz
avcodec/dstdec: Fix integer overflow in read_table()
Fixes: signed integer overflow: -16 * 134217879 cannot be represented in type 'int' Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5639509530378240 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 2d465a401dd790e2ca126ecb9cbda43f898a492f) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/dstdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c
index c548174331..b70e0d27ec 100644
--- a/libavcodec/dstdec.c
+++ b/libavcodec/dstdec.c
@@ -155,7 +155,7 @@ static int read_table(GetBitContext *gb, Table *t, const int8_t code_pred_coeff[
for (j = method + 1; j < t->length[i]; j++) {
int c, x = 0;
for (k = 0; k < method + 1; k++)
- x += code_pred_coeff[method][k] * t->coeff[i][j - k - 1];
+ x += code_pred_coeff[method][k] * (unsigned)t->coeff[i][j - k - 1];
c = get_sr_golomb_dst(gb, lsb_size);
if (x >= 0)
c -= (x + 4) / 8;