[FFmpeg-devel,6/6] avcodec/truespeech: Fix integer overflow in truespeech_synth()

Submitted by Michael Niedermayer on Oct. 7, 2019, 4:39 p.m.

Details

Message ID 20191007163922.32135-6-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer Oct. 7, 2019, 4:39 p.m.
Fixes: signed integer overflow: -1801695444 + -830224908 cannot be represented in type 'int'
Fixes: 17995/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUESPEECH_fuzzer-5648084880588800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/truespeech.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c
index 799cef0945..d7c2d535e2 100644
--- a/libavcodec/truespeech.c
+++ b/libavcodec/truespeech.c
@@ -254,7 +254,7 @@  static void truespeech_synth(TSContext *dec, int16_t *out, int quart)
     for(i = 0; i < 60; i++){
         int sum = 0;
         for(k = 0; k < 8; k++)
-            sum += ptr0[k] * ptr1[k];
+            sum += ptr0[k] * (unsigned)ptr1[k];
         sum = out[i] + ((sum + 0x800) >> 12);
         out[i] = av_clip(sum, -0x7FFE, 0x7FFE);
         for(k = 7; k > 0; k--)