Skip to content

Commit

Permalink
Fix overflows in accumulation, fixing crashes
Browse files Browse the repository at this point in the history
This fixes github issue #83.
  • Loading branch information
mstorsjo committed May 4, 2018
1 parent ca3697f commit 29e4d6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libSBRenc/src/tran_det.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@ static FIXP_DBL addLowbandEnergies(FIXP_DBL **Energies,
/* freqBandTable[LORES] has MAX_FREQ_COEFFS/2 +1 coeefs max. */
for (ts=tran_offdiv2; ts<YBufferWriteOffset; ts++) {
for (k = 0; k < freqBandTable[0]; k++) {
accu1 += Energies[ts][k] >> 6;
accu1 = fAddSaturate(accu1, Energies[ts][k] >> 6);
}
}
for (; ts<tran_offdiv2+(slots>>nrgSzShift); ts++) {
for (k = 0; k < freqBandTable[0]; k++) {
accu2 += Energies[ts][k] >> 9;
accu2 = fAddSaturate(accu2, Energies[ts][k] >> 9);
}
}

Expand Down

0 comments on commit 29e4d6c

Please sign in to comment.