Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-08 21:24:48 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-09 01:42:20 +0300
commitd3088e0fd8749788818cb5df92abaa3b12e409e1 (patch)
treea0b1d9bf5d22d724d14e1d69bdbd057fc960f1e3 /libavcodec/g723_1dec.c
parent7f7ee86d5a494ddbcb22c83dec970f38a8ccd7b4 (diff)
avcodec/g723_1dec: Fix several integer related cases of undefined behaviour
Fixes: 1412/clusterfuzz-testcase-minimized-6561308772139008 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/g723_1dec.c')
-rw-r--r--libavcodec/g723_1dec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/g723_1dec.c b/libavcodec/g723_1dec.c
index 0b9fd39946..6d452df189 100644
--- a/libavcodec/g723_1dec.c
+++ b/libavcodec/g723_1dec.c
@@ -664,7 +664,7 @@ static int estimate_sid_gain(G723_1_Context *p)
t = p->sid_gain << shift;
else
t = p->sid_gain >> -shift;
- x = t * cng_filt[0] >> 16;
+ x = av_clipl_int32(t * (int64_t)cng_filt[0] >> 16);
if (x >= cng_bseg[2])
return 0x3F;
@@ -733,7 +733,7 @@ static void generate_noise(G723_1_Context *p)
off[i * 2 + 1] = ((t >> 1) & 1) + SUBFRAME_LEN;
t >>= 2;
for (j = 0; j < 11; j++) {
- signs[i * 11 + j] = (t & 1) * 2 - 1 << 14;
+ signs[i * 11 + j] = ((t & 1) * 2 - 1) * (1 << 14);
t >>= 1;
}
}
@@ -777,7 +777,7 @@ static void generate_noise(G723_1_Context *p)
sum = 0;
if (shift < 0) {
for (j = 0; j < SUBFRAME_LEN * 2; j++) {
- t = vector_ptr[j] << -shift;
+ t = vector_ptr[j] * (1 << -shift);
sum += t * t;
tmp[j] = t;
}
@@ -815,7 +815,7 @@ static void generate_noise(G723_1_Context *p)
if (shift < 0)
x >>= -shift;
else
- x <<= shift;
+ x *= 1 << shift;
x = av_clip(x, -10000, 10000);
for (j = 0; j < 11; j++) {