aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src/aacdecoder_lib.cpp
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2020-04-09 17:54:33 +0200
committerJean-Michel Trivi <jmtrivi@google.com>2020-12-23 15:08:03 -0800
commit883c1143990c6d41abdadcb18cf8d084aeb8630d (patch)
treeecf32c2d90b4120bb16e8e7cc732d9eb5250bff2 /libAACdec/src/aacdecoder_lib.cpp
parentaad908c262eaffec9728851ff410c7991893111a (diff)
downloadfdk-aac-883c1143990c6d41abdadcb18cf8d084aeb8630d.tar.gz
fdk-aac-883c1143990c6d41abdadcb18cf8d084aeb8630d.tar.bz2
fdk-aac-883c1143990c6d41abdadcb18cf8d084aeb8630d.zip
Validate DRC compression factor and DRC boost factor value range in aacDecoder_SetParam().
Bug: 176246647 Test: atest DecoderTestXheAac DecoderTestAacDrc Change-Id: I1d8534145bcf400c5da58d64d3b7e73a87cb43be
Diffstat (limited to 'libAACdec/src/aacdecoder_lib.cpp')
-rw-r--r--libAACdec/src/aacdecoder_lib.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp
index 0f281eb..4c0d347 100644
--- a/libAACdec/src/aacdecoder_lib.cpp
+++ b/libAACdec/src/aacdecoder_lib.cpp
@@ -822,6 +822,9 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_SetParam(
case AAC_DRC_ATTENUATION_FACTOR:
/* 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);
uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_COMPRESS,
value * (FL2FXCONST_DBL(0.5f / 127.0f)));
@@ -829,6 +832,9 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_SetParam(
case AAC_DRC_BOOST_FACTOR:
/* 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);
uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_BOOST,
value * (FL2FXCONST_DBL(0.5f / 127.0f)));