History

avcodec/aacsbr_fixed: Fix multiple runtime error: left shift of negative value -407

Fixes: 1674/clusterfuzz-testcase-minimized-6092531563495424 Fixes: 1686/clusterfuzz-testcase-minimized-6282691643179008

Michael Niedermayer committed 9 years ago

Commit 2ccd2c91 parent 55b56a83 files · +8 −8Browse files

Unified · Split

3 files
  1. libavcodec/aacdec_template.c +2 −2
  2. libavcodec/aacsbr_fixed.c +4 −4
  3. libavcodec/sbrdsp_fixed.c +2 −2
libavcodec/aacdec_template.c+2−2
@@ -2800,9 +2800,9 @@ static void spectral_to_sample(AACContext *ac, int samples) · 2799 unmodified lines
28002800 int j;
28012801 /* preparation for resampler */
28022802 for(j = 0; j<samples; j++){
2803− che->ch[0].ret[j] = (int32_t)av_clip64((int64_t)che->ch[0].ret[j]<<7, INT32_MIN, INT32_MAX-0x8000)+0x8000;
2803+ che->ch[0].ret[j] = (int32_t)av_clip64((int64_t)che->ch[0].ret[j]*128, INT32_MIN, INT32_MAX-0x8000)+0x8000;
28042804 if(type == TYPE_CPE)
2805− che->ch[1].ret[j] = (int32_t)av_clip64((int64_t)che->ch[1].ret[j]<<7, INT32_MIN, INT32_MAX-0x8000)+0x8000;
2805+ che->ch[1].ret[j] = (int32_t)av_clip64((int64_t)che->ch[1].ret[j]*128, INT32_MIN, INT32_MAX-0x8000)+0x8000;
28062806 }
28072807 }
28082808 #endif /* USE_FIXED */
libavcodec/aacsbr_fixed.c+4−4
@@ -289,7 +289,7 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp, · 288 unmodified lines
289289 if (shift >= 3)
290290 alpha0[k][0] = 0x7fffffff;
291291 else {
292− a00.mant <<= 1;
292+ a00.mant *= 2;
293293 shift = 2-shift;
294294 if (shift == 0)
295295 alpha0[k][0] = a00.mant;
@@ -303,7 +303,7 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp, · 7 unmodified lines
303303 if (shift >= 3)
304304 alpha0[k][1] = 0x7fffffff;
305305 else {
306− a01.mant <<= 1;
306+ a01.mant *= 2;
307307 shift = 2-shift;
308308 if (shift == 0)
309309 alpha0[k][1] = a01.mant;
@@ -316,7 +316,7 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp, · 6 unmodified lines
316316 if (shift >= 3)
317317 alpha1[k][0] = 0x7fffffff;
318318 else {
319− a10.mant <<= 1;
319+ a10.mant *= 2;
320320 shift = 2-shift;
321321 if (shift == 0)
322322 alpha1[k][0] = a10.mant;
@@ -330,7 +330,7 @@ static void sbr_hf_inverse_filter(SBRDSPContext *dsp, · 7 unmodified lines
330330 if (shift >= 3)
331331 alpha1[k][1] = 0x7fffffff;
332332 else {
333− a11.mant <<= 1;
333+ a11.mant *= 2;
334334 shift = 2-shift;
335335 if (shift == 0)
336336 alpha1[k][1] = a11.mant;
libavcodec/sbrdsp_fixed.c+2−2
@@ -116,7 +116,7 @@ static av_always_inline SoftFloat autocorr_calc(int64_t accu) · 115 unmodified lines
116116 } else {
117117 nz = 0;
118118 while (FFABS(i) < 0x40000000) {
119− i <<= 1;
119+ i *= 2;
120120 nz++;
121121 }
122122 nz = 32-nz;
@@ -125,7 +125,7 @@ static av_always_inline SoftFloat autocorr_calc(int64_t accu) · 2 unmodified lines
125125 round = 1U << (nz-1);
126126 mant = (int)((accu + round) >> nz);
127127 mant = (mant + 0x40)>>7;
128− mant <<= 6;
128+ mant *= 64;
129129 expo = nz + 15;
130130 return av_int2sf(mant, 30 - expo);
131131 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t