diff options
author | Fraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de> | 2019-11-13 16:05:46 +0100 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2020-01-14 14:44:56 -0800 |
commit | 25fb9adf6fe129e0b74fe78c04526a57b8210f29 (patch) | |
tree | 0a6f30b1bd8182c5f026ceffd57dbcf8fad875ac /libSACdec/src | |
parent | 76c229c01896506f1c77929b1748fa6ed5ee1e27 (diff) | |
download | fdk-aac-25fb9adf6fe129e0b74fe78c04526a57b8210f29.tar.gz fdk-aac-25fb9adf6fe129e0b74fe78c04526a57b8210f29.tar.bz2 fdk-aac-25fb9adf6fe129e0b74fe78c04526a57b8210f29.zip |
Avoid signed integer overflows in SpatialDecApplyParameterSets() when adding dry and wet signal.
Bug: 146936964
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: Idb4242d54b2e61805ab071a8977eed8f06081edf
Diffstat (limited to 'libSACdec/src')
-rw-r--r-- | libSACdec/src/sac_dec.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libSACdec/src/sac_dec.cpp b/libSACdec/src/sac_dec.cpp index 3f55a7d..c1832f1 100644 --- a/libSACdec/src/sac_dec.cpp +++ b/libSACdec/src/sac_dec.cpp @@ -1317,10 +1317,12 @@ static SACDEC_ERROR SpatialDecApplyParameterSets( if ((self->tempShapeConfig == 1) && (!isTwoChMode(self->upmixType))) { for (ch = 0; ch < self->numOutputChannels; ch++) { for (hyb = 0; hyb < self->tp_hybBandBorder; hyb++) { - self->hybOutputRealDry__FDK[ch][hyb] += - self->hybOutputRealWet__FDK[ch][hyb]; - self->hybOutputImagDry__FDK[ch][hyb] += - self->hybOutputImagWet__FDK[ch][hyb]; + self->hybOutputRealDry__FDK[ch][hyb] = + fAddSaturate(self->hybOutputRealDry__FDK[ch][hyb], + self->hybOutputRealWet__FDK[ch][hyb]); + self->hybOutputImagDry__FDK[ch][hyb] = + fAddSaturate(self->hybOutputImagDry__FDK[ch][hyb], + self->hybOutputImagWet__FDK[ch][hyb]); } /* loop hyb */ } /* loop ch */ err = subbandTPApply( @@ -1341,11 +1343,11 @@ static SACDEC_ERROR SpatialDecApplyParameterSets( FIXP_DBL *RESTRICT pRealWet = self->hybOutputRealWet__FDK[ch]; FIXP_DBL *RESTRICT pImagWet = self->hybOutputImagWet__FDK[ch]; for (hyb = 0; hyb < nHybBands; hyb++) { - pRealDry[hyb] += pRealWet[hyb]; - pImagDry[hyb] += pImagWet[hyb]; + pRealDry[hyb] = fAddSaturate(pRealDry[hyb], pRealWet[hyb]); + pImagDry[hyb] = fAddSaturate(pImagDry[hyb], pImagWet[hyb]); } /* loop hyb */ for (; hyb < self->hybridBands; hyb++) { - pRealDry[hyb] += pRealWet[hyb]; + pRealDry[hyb] = fAddSaturate(pRealDry[hyb], pRealWet[hyb]); } /* loop hyb */ } /* loop ch */ } /* ( self->tempShapeConfig == 1 ) || ( self->tempShapeConfig == 2 ) */ |