summaryrefslogtreecommitdiffstats
path: root/libAACenc/src/grp_data.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2012-08-10 00:51:37 +0300
committerMartin Storsjo <martin@martin.st>2012-08-10 11:01:36 +0300
commit839ae290c1f5a263613bea1a5fde863e757a8849 (patch)
tree868a5773eec2ec0c3df04dc7141e058d1280a0e1 /libAACenc/src/grp_data.cpp
parentd8e8f1ac46cd55ded2dd42adf89e95092bcc04ea (diff)
downloadfdk-aac-839ae290c1f5a263613bea1a5fde863e757a8849.tar.gz
fdk-aac-839ae290c1f5a263613bea1a5fde863e757a8849.tar.bz2
fdk-aac-839ae290c1f5a263613bea1a5fde863e757a8849.zip
Use saturating adds to avoid overflow
These additions can overflow, triggering assertions later.
Diffstat (limited to 'libAACenc/src/grp_data.cpp')
-rw-r--r--libAACenc/src/grp_data.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libAACenc/src/grp_data.cpp b/libAACenc/src/grp_data.cpp
index 03d4976..7adcb21 100644
--- a/libAACenc/src/grp_data.cpp
+++ b/libAACenc/src/grp_data.cpp
@@ -195,7 +195,7 @@ FDKaacEnc_groupShortData(FIXP_DBL *mdctSpectrum, /* in-out
FIXP_DBL energy = sfbEnergy->Short[wnd][sfb];
for (j=1; j<groupLen[grp]; j++)
{
- energy += sfbEnergy->Short[wnd+j][sfb];
+ energy = fAddSaturate(energy, sfbEnergy->Short[wnd+j][sfb]);
}
sfbEnergy->Long[i++] = energy;
}