aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-02-12 21:30:08 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-05-19 17:17:36 +0200
commit2f747b2d827612e1d4c071e6c7a1f7a748c8ef1d (patch)
treec31158cd492a88376822068373c605de6491b753
parent8d08b70cbcc97f2ac88a81b3c562bbaf8b463836 (diff)
downloadffmpeg-2f747b2d827612e1d4c071e6c7a1f7a748c8ef1d.tar.gz
avcodec/adpcm: Fix integer overflow in ADPCM THP
The reference (thp.txt) uses floats so wrap around would seem incorrect. Fixes: signed integer overflow: 1073741824 + 1073741824 cannot be represented in type 'int' Fixes: 20658/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_THP_fuzzer-5646302555930624 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 b12b05374f7025167e2c43449ceb8ba3f0a6083f) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/adpcm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 03fd021c0a..54e708c2c7 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1632,8 +1632,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
int byte = bytestream2_get_byteu(&gb);
int index = (byte >> 4) & 7;
unsigned int exp = byte & 0x0F;
- int factor1 = table[ch][index * 2];
- int factor2 = table[ch][index * 2 + 1];
+ int64_t factor1 = table[ch][index * 2];
+ int64_t factor2 = table[ch][index * 2 + 1];
/* Decode 14 samples. */
for (n = 0; n < 14 && (i * 14 + n < nb_samples); n++) {