aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-21 00:06:10 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-06-05 23:16:54 +0200
commit88fabd801693545b4d1de360fbad373d61374574 (patch)
tree6f994508a0f38e61e8c2f94fef2eb96e7540d6a3
parent24d744cabe0883655884c8786b3ad908736d5d09 (diff)
downloadffmpeg-88fabd801693545b4d1de360fbad373d61374574.tar.gz
avcodec/aacsbr_fixed: Fix multiple runtime error: shift exponent 170 is too large for 32-bit type 'int'
Fixes part of 1709/clusterfuzz-testcase-minimized-4513580554649600 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 6310fc714de3cd73848416ead73228fcef8b6dc0) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/aacsbr_fixed.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
index a56305746b..2410c25d80 100644
--- a/libavcodec/aacsbr_fixed.c
+++ b/libavcodec/aacsbr_fixed.c
@@ -578,20 +578,25 @@ static void sbr_hf_assemble(int Y1[38][64][2],
SoftFloat *in = sbr->s_m[e];
for (m = 0; m+1 < m_max; m+=2) {
- shift = 22 - in[m ].exp;
- round = 1 << (shift-1);
- out[2*m ] += (in[m ].mant * A + round) >> shift;
+ shift = 22 - in[m ].exp;
+ if (shift < 32) {
+ round = 1 << (shift-1);
+ out[2*m ] += (in[m ].mant * A + round) >> shift;
+ }
- shift = 22 - in[m+1].exp;
- round = 1 << (shift-1);
- out[2*m+2] += (in[m+1].mant * B + round) >> shift;
+ shift = 22 - in[m+1].exp;
+ if (shift < 32) {
+ round = 1 << (shift-1);
+ out[2*m+2] += (in[m+1].mant * B + round) >> shift;
+ }
}
if(m_max&1)
{
- shift = 22 - in[m ].exp;
- round = 1 << (shift-1);
-
- out[2*m ] += (in[m ].mant * A + round) >> shift;
+ shift = 22 - in[m ].exp;
+ if (shift < 32) {
+ round = 1 << (shift-1);
+ out[2*m ] += (in[m ].mant * A + round) >> shift;
+ }
}
}
indexnoise = (indexnoise + m_max) & 0x1ff;