aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src/conceal.cpp
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2018-08-15 14:42:23 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2018-09-05 15:03:18 -0700
commitf44b50b83529604f1b22e77084f50d575262c4fc (patch)
tree8c734cf6a6ec81107989c17e0bccab36eb24da1f /libAACdec/src/conceal.cpp
parentf19e863cce96cc1e5f4ad7ce512810d5a2843ea6 (diff)
downloadfdk-aac-f44b50b83529604f1b22e77084f50d575262c4fc.tar.gz
fdk-aac-f44b50b83529604f1b22e77084f50d575262c4fc.tar.bz2
fdk-aac-f44b50b83529604f1b22e77084f50d575262c4fc.zip
Prevent overflow in concealment clipping check
Bug: 112890225 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: Ie386e4b6fe5cdb38180f673edde8f84c36c7b522
Diffstat (limited to 'libAACdec/src/conceal.cpp')
-rw-r--r--libAACdec/src/conceal.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libAACdec/src/conceal.cpp b/libAACdec/src/conceal.cpp
index a6064b6..569d672 100644
--- a/libAACdec/src/conceal.cpp
+++ b/libAACdec/src/conceal.cpp
@@ -2080,11 +2080,11 @@ static void CConcealment_TDNoise_Apply(CConcealmentInfo *const pConcealmentInfo,
noiseVal = FX_DBL2FX_PCM(fMult(noiseValLong, TDNoiseAtt));
/* add filtered noise - check for clipping, before */
- if (pcmdata[ii] > (FIXP_PCM)MAXVAL_FIXP_PCM - noiseVal &&
- noiseVal > (FIXP_PCM)0) {
+ if (noiseVal > (FIXP_PCM)0 &&
+ pcmdata[ii] > (FIXP_PCM)MAXVAL_FIXP_PCM - noiseVal) {
noiseVal = noiseVal * (FIXP_PCM)-1;
- } else if (pcmdata[ii] < (FIXP_PCM)MINVAL_FIXP_PCM - noiseVal &&
- noiseVal < (FIXP_PCM)0) {
+ } else if (noiseVal < (FIXP_PCM)0 &&
+ pcmdata[ii] < (FIXP_PCM)MINVAL_FIXP_PCM - noiseVal) {
noiseVal = noiseVal * (FIXP_PCM)-1;
}