avcodec/ilbcdec: Simplify use of unsigned and fix more undefined overflows

Fixes: signed integer overflow: 2147475672 + 8192 cannot be represented in type 'int'
Fixes: 15415/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ILBC_fuzzer-5712074128228352

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2019-06-30 23:28:13 +02:00
parent 1bb3b3f11c
commit 019d729039
1 changed files with 3 additions and 3 deletions

View File

@ -724,7 +724,7 @@ static void construct_vector (
int16_t cbvec0[SUBL];
int16_t cbvec1[SUBL];
int16_t cbvec2[SUBL];
int32_t a32;
unsigned a32;
int16_t *gainPtr;
int j;
@ -745,9 +745,9 @@ static void construct_vector (
for (j = 0; j < veclen; j++) {
a32 = SPL_MUL_16_16(*gainPtr++, cbvec0[j]);
a32 += SPL_MUL_16_16(*gainPtr++, cbvec1[j]);
a32 += (unsigned)SPL_MUL_16_16(*gainPtr, cbvec2[j]);
a32 += SPL_MUL_16_16(*gainPtr, cbvec2[j]);
gainPtr -= 2;
decvector[j] = (a32 + 8192) >> 14;
decvector[j] = (int)(a32 + 8192) >> 14;
}
}