aboutsummaryrefslogtreecommitdiffstats
path: root/libSBRenc/src
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2018-05-04 12:46:44 +0300
committerMartin Storsjo <martin@martin.st>2018-05-04 12:47:17 +0300
commita50eecf65b5ce5d4f03768c5c2cb4b492d2badad (patch)
tree3e77ce5a153a96538e81ab0edb4ddd246a3db68a /libSBRenc/src
parenta30bfced6b6d6d976c728552d247cb30dd86e238 (diff)
downloadfdk-aac-a50eecf65b5ce5d4f03768c5c2cb4b492d2badad.tar.gz
fdk-aac-a50eecf65b5ce5d4f03768c5c2cb4b492d2badad.tar.bz2
fdk-aac-a50eecf65b5ce5d4f03768c5c2cb4b492d2badad.zip
Fix overflows in accumulation, fixing crashes
This fixes github issue #83.
Diffstat (limited to 'libSBRenc/src')
-rw-r--r--libSBRenc/src/tran_det.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libSBRenc/src/tran_det.cpp b/libSBRenc/src/tran_det.cpp
index 0e35ec3..51d6efe 100644
--- a/libSBRenc/src/tran_det.cpp
+++ b/libSBRenc/src/tran_det.cpp
@@ -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);
}
}