Validate DRC compression factor and DRC boost factor value range in aacDecoder_SetParam().

Bug: 176246647
Test: atest DecoderTestXheAac DecoderTestAacDrc
Change-Id: I1d8534145bcf400c5da58d64d3b7e73a87cb43be
This commit is contained in:
Fraunhofer IIS FDK 2020-04-09 17:54:33 +02:00 committed by Ray Essick
parent a7c64ff42f
commit baa3203971
1 changed files with 6 additions and 0 deletions

View File

@ -820,6 +820,9 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_SetParam(
case AAC_DRC_ATTENUATION_FACTOR: case AAC_DRC_ATTENUATION_FACTOR:
/* DRC compression factor (where 0 is no and 127 is max compression) */ /* DRC compression factor (where 0 is no and 127 is max compression) */
if ((value < 0) || (value > 127)) {
return AAC_DEC_SET_PARAM_FAIL;
}
errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_CUT_SCALE, value); errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_CUT_SCALE, value);
uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_COMPRESS, uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_COMPRESS,
value * (FL2FXCONST_DBL(0.5f / 127.0f))); value * (FL2FXCONST_DBL(0.5f / 127.0f)));
@ -827,6 +830,9 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_SetParam(
case AAC_DRC_BOOST_FACTOR: case AAC_DRC_BOOST_FACTOR:
/* DRC boost factor (where 0 is no and 127 is max boost) */ /* DRC boost factor (where 0 is no and 127 is max boost) */
if ((value < 0) || (value > 127)) {
return AAC_DEC_SET_PARAM_FAIL;
}
errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_BOOST_SCALE, value); errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_BOOST_SCALE, value);
uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_BOOST, uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_BOOST,
value * (FL2FXCONST_DBL(0.5f / 127.0f))); value * (FL2FXCONST_DBL(0.5f / 127.0f)));