1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-02-04 01:37:50 +01:00

Merge "Fix potential invalid memory access for concealment in decodeEnvelope()"

This commit is contained in:
Jean-Michel Trivi 2018-12-28 23:03:46 +00:00 committed by Gerrit Code Review
commit 6acfe3b799

View File

@ -506,18 +506,23 @@ static void decodeEnvelope(
*/ */
for (i = 0; i < hHeaderData->freqBandData.nSfb[1]; i++) { for (i = 0; i < hHeaderData->freqBandData.nSfb[1]; i++) {
/* Former Level-Channel will be used for both channels */ /* Former Level-Channel will be used for both channels */
if (h_prev_data->coupling == COUPLING_BAL) if (h_prev_data->coupling == COUPLING_BAL) {
h_prev_data->sfb_nrg_prev[i] = otherChannel->sfb_nrg_prev[i]; h_prev_data->sfb_nrg_prev[i] =
(otherChannel != NULL) ? otherChannel->sfb_nrg_prev[i]
: (FIXP_SGL)SBR_ENERGY_PAN_OFFSET;
}
/* Former L/R will be combined as the new Level-Channel */ /* Former L/R will be combined as the new Level-Channel */
else if (h_sbr_data->coupling == COUPLING_LEVEL) else if (h_sbr_data->coupling == COUPLING_LEVEL &&
otherChannel != NULL) {
h_prev_data->sfb_nrg_prev[i] = (h_prev_data->sfb_nrg_prev[i] + h_prev_data->sfb_nrg_prev[i] = (h_prev_data->sfb_nrg_prev[i] +
otherChannel->sfb_nrg_prev[i]) >> otherChannel->sfb_nrg_prev[i]) >>
1; 1;
else if (h_sbr_data->coupling == COUPLING_BAL) } else if (h_sbr_data->coupling == COUPLING_BAL) {
h_prev_data->sfb_nrg_prev[i] = (FIXP_SGL)SBR_ENERGY_PAN_OFFSET; h_prev_data->sfb_nrg_prev[i] = (FIXP_SGL)SBR_ENERGY_PAN_OFFSET;
} }
} }
} }
}
FDKmemcpy(tempSfbNrgPrev, h_prev_data->sfb_nrg_prev, FDKmemcpy(tempSfbNrgPrev, h_prev_data->sfb_nrg_prev,
MAX_FREQ_COEFFS * sizeof(FIXP_SGL)); MAX_FREQ_COEFFS * sizeof(FIXP_SGL));