aboutsummaryrefslogtreecommitdiffstats
path: root/libSACdec
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2018-12-20 15:52:46 +0100
committerJean-Michel Trivi <jmtrivi@google.com>2019-01-02 13:28:34 -0500
commit4a22282fe0cbf79555ea4535fa9723966509912a (patch)
tree58d8d679ced97d7ab34c6b1639edb5cdaeb9cc74 /libSACdec
parent0142f389049f4f291908af7812d83d959ea52b48 (diff)
downloadfdk-aac-4a22282fe0cbf79555ea4535fa9723966509912a.tar.gz
fdk-aac-4a22282fe0cbf79555ea4535fa9723966509912a.tar.bz2
fdk-aac-4a22282fe0cbf79555ea4535fa9723966509912a.zip
Add sanity check in SpatialDecParseSpecificConfig()
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I0249f75839829fdbc96218425e59ad914f9dfeda
Diffstat (limited to 'libSACdec')
-rw-r--r--libSACdec/src/sac_bitdec.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/libSACdec/src/sac_bitdec.cpp b/libSACdec/src/sac_bitdec.cpp
index 159cf84..da5b262 100644
--- a/libSACdec/src/sac_bitdec.cpp
+++ b/libSACdec/src/sac_bitdec.cpp
@@ -572,16 +572,18 @@ SACDEC_ERROR SpatialDecParseSpecificConfig(
numHeaderBits = cfgStartPos - (INT)FDKgetValidBits(bitstream);
bitsAvailable -= numHeaderBits;
+ if (bitsAvailable < 0) {
+ err = MPS_PARSE_ERROR;
+ goto bail;
+ }
pSpatialSpecificConfig->sacExtCnt = 0;
pSpatialSpecificConfig->bResidualCoding = 0;
- if ((err == MPS_OK) && (bitsAvailable > 0)) {
- err = SpatialDecParseExtensionConfig(
- bitstream, pSpatialSpecificConfig, pSpatialSpecificConfig->nOttBoxes,
- pSpatialSpecificConfig->nTttBoxes,
- pSpatialSpecificConfig->nOutputChannels, bitsAvailable);
- }
+ err = SpatialDecParseExtensionConfig(
+ bitstream, pSpatialSpecificConfig, pSpatialSpecificConfig->nOttBoxes,
+ pSpatialSpecificConfig->nTttBoxes,
+ pSpatialSpecificConfig->nOutputChannels, bitsAvailable);
FDKbyteAlign(
bitstream,