]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/dstdec: Fix integer overflow in read_table()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 8 Feb 2020 23:23:14 +0000 (00:23 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 2 May 2020 15:28:06 +0000 (17:28 +0200)
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>
libavcodec/dstdec.c

index bdabced823e7700208a5ddfc4db4c342157268e9..9feca4b085fea86e7b10eea9255d983e268a8b4c 100644 (file)
@@ -156,7 +156,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;