1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-02-06 10:43:25 +01:00

Avoid signed integer overflows in SpatialDecApplyParameterSets() when adding dry and wet signal.

Bug: 146936964
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: Idb4242d54b2e61805ab071a8977eed8f06081edf
This commit is contained in:
Fraunhofer IIS FDK 2019-11-13 16:05:46 +01:00 committed by Jean-Michel Trivi
parent 76c229c018
commit 25fb9adf6f

View File

@ -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 ) */