aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-01-31 18:13:07 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-02-12 03:02:29 +0100
commit5b6324a94c2086fcd243f2f615024b32fa1e27ce (patch)
tree82d9e5cd87e332c59029af38393b1776573f2e31
parentc95d343ae17039510cd779eecc739b3641cc53f6 (diff)
downloadffmpeg-5b6324a94c2086fcd243f2f615024b32fa1e27ce.tar.gz
avcodec/aacsbr_fixed: Fix overflows in rounding in sbr_hf_assemble()
Fixes: runtime error: signed integer overflow: 2052929346 + 204817098 cannot be represented in type 'int' Fixes: 5275/clusterfuzz-testcase-minimized-5367635958038528 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 b1bef755f617af9685b592d866b3eb7f3c4b02b1) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/aacsbr_fixed.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
index e245ed56ee..44c899a7f1 100644
--- a/libavcodec/aacsbr_fixed.c
+++ b/libavcodec/aacsbr_fixed.c
@@ -575,7 +575,8 @@ static void sbr_hf_assemble(int Y1[38][64][2],
int A = (1-((indexsine+(kx & 1))&2));
int B = (A^(-idx)) + idx;
int *out = &Y1[i][kx][idx];
- int shift, round;
+ int shift;
+ unsigned round;
SoftFloat *in = sbr->s_m[e];
for (m = 0; m+1 < m_max; m+=2) {
@@ -588,12 +589,12 @@ static void sbr_hf_assemble(int Y1[38][64][2],
}
if (shift < 32) {
round = 1 << (shift-1);
- out[2*m ] += (in[m ].mant * A + round) >> shift;
+ out[2*m ] += (int)(in[m ].mant * A + round) >> shift;
}
if (shift2 < 32) {
round = 1 << (shift2-1);
- out[2*m+2] += (in[m+1].mant * B + round) >> shift2;
+ out[2*m+2] += (int)(in[m+1].mant * B + round) >> shift2;
}
}
if(m_max&1)
@@ -604,7 +605,7 @@ static void sbr_hf_assemble(int Y1[38][64][2],
return;
} else if (shift < 32) {
round = 1 << (shift-1);
- out[2*m ] += (in[m ].mant * A + round) >> shift;
+ out[2*m ] += (int)(in[m ].mant * A + round) >> shift;
}
}
}