aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src/usacdec_lpc.cpp
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2019-09-20 14:02:46 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2019-10-15 15:49:37 -0700
commit3c377e33055267a007566a550820ae1cdb135331 (patch)
treefb1422b4bb05dca07192ac2af294161841d52c00 /libAACdec/src/usacdec_lpc.cpp
parent4db9f39f6d1a4f89e3891d29345201a04eef43f0 (diff)
downloadfdk-aac-3c377e33055267a007566a550820ae1cdb135331.tar.gz
fdk-aac-3c377e33055267a007566a550820ae1cdb135331.tar.bz2
fdk-aac-3c377e33055267a007566a550820ae1cdb135331.zip
Prevent signed integer overflow in RE8_PPV().
Bug: 131430997 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: Ic66ac4742d8e466431c5cf09d02b0d9c7f842df2
Diffstat (limited to 'libAACdec/src/usacdec_lpc.cpp')
-rw-r--r--libAACdec/src/usacdec_lpc.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libAACdec/src/usacdec_lpc.cpp b/libAACdec/src/usacdec_lpc.cpp
index 278afbe..d726798 100644
--- a/libAACdec/src/usacdec_lpc.cpp
+++ b/libAACdec/src/usacdec_lpc.cpp
@@ -231,7 +231,7 @@ void nearest_neighbor_2D8(FIXP_ZF x[8], int y[8]) {
void RE8_PPV(FIXP_ZF x[], SHORT y[], int r) {
int i, y0[8], y1[8];
FIXP_ZF x1[8], tmp;
- FIXP_DBL e;
+ INT64 e;
/* find the nearest neighbor y0 of x in 2D8 */
nearest_neighbor_2D8(x, y0);
@@ -245,16 +245,16 @@ void RE8_PPV(FIXP_ZF x[], SHORT y[], int r) {
}
/* compute e0=||x-y0||^2 and e1=||x-y1||^2 */
- e = (FIXP_DBL)0;
+ e = 0;
for (i = 0; i < 8; i++) {
tmp = x[i] - INT2ZF(y0[i], 0);
- e += fPow2Div2(
+ e += (INT64)fPow2Div2(
tmp << r); /* shift left to ensure that no fract part bits get lost. */
tmp = x[i] - INT2ZF(y1[i], 0);
- e -= fPow2Div2(tmp << r);
+ e -= (INT64)fPow2Div2(tmp << r);
}
/* select best candidate y0 or y1 to minimize distortion */
- if (e < (FIXP_DBL)0) {
+ if (e < 0) {
for (i = 0; i < 8; i++) {
y[i] = y0[i];
}