diff options
author | Martin Storsjo <martin@martin.st> | 2020-06-04 09:46:46 +0300 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2020-06-04 09:50:16 +0300 |
commit | 5aa57d363353a635c4ee877ff4f2351f17ded59b (patch) | |
tree | 0b632daa9a5ee36b34682aa9115336c45aa7ae98 | |
parent | e7d8591ff208803eee35dc289e89a0d69b707585 (diff) | |
download | fdk-aac-5aa57d363353a635c4ee877ff4f2351f17ded59b.tar.gz fdk-aac-5aa57d363353a635c4ee877ff4f2351f17ded59b.tar.bz2 fdk-aac-5aa57d363353a635c4ee877ff4f2351f17ded59b.zip |
Don't use an enum for a value read directly from the bitstream
The enum doesn't cover all possible values read from the bitstream.
This fixes undefined behaviour sanitizer errors.
Fixes: 22486/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBFDK_AAC_fuzzer-5735284884111360
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
-rw-r--r-- | libMpegTPDec/src/tpdec_asc.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libMpegTPDec/src/tpdec_asc.cpp b/libMpegTPDec/src/tpdec_asc.cpp index 0f80a4b..b10602d 100644 --- a/libMpegTPDec/src/tpdec_asc.cpp +++ b/libMpegTPDec/src/tpdec_asc.cpp @@ -1325,7 +1325,7 @@ static TRANSPORTDEC_ERROR EldSpecificConfig_Parse(CSAudioSpecificConfig *asc, CSTpCallBacks *cb) { TRANSPORTDEC_ERROR ErrorStatus = TRANSPORTDEC_OK; CSEldSpecificConfig *esc = &asc->m_sc.m_eldSpecificConfig; - ASC_ELD_EXT_TYPE eldExtType; + int eldExtType; int eldExtLen, len, cnt, ldSbrLen = 0, eldExtLenSum, numSbrHeader = 0, sbrIndex; @@ -1395,7 +1395,7 @@ static TRANSPORTDEC_ERROR EldSpecificConfig_Parse(CSAudioSpecificConfig *asc, esc->m_downscaledSamplingFrequency = asc->m_samplingFrequency; /* parse ExtTypeConfigData */ while ( - ((eldExtType = (ASC_ELD_EXT_TYPE)FDKreadBits(hBs, 4)) != ELDEXT_TERM) && + ((eldExtType = FDKreadBits(hBs, 4)) != ELDEXT_TERM) && ((INT)FDKgetValidBits(hBs) >= 0)) { eldExtLen = len = FDKreadBits(hBs, 4); if (len == 0xf) { |