diff options
author | Martin Storsjo <martin@martin.st> | 2020-11-17 12:15:20 +0200 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2020-11-17 12:26:19 +0200 |
commit | 4e944af756ec44e73b78bbed84a01fa9d2dfa5f5 (patch) | |
tree | c42284a4c445f5bd2ccf3a66967f722d4b184aad | |
parent | 3a831a5fbc990c83e9b5b804a082bb158364e793 (diff) | |
download | fdk-aac-4e944af756ec44e73b78bbed84a01fa9d2dfa5f5.tar.gz fdk-aac-4e944af756ec44e73b78bbed84a01fa9d2dfa5f5.tar.bz2 fdk-aac-4e944af756ec44e73b78bbed84a01fa9d2dfa5f5.zip |
Avoid undefined shifts in SBR calcCRC
Fixes: 25404/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBFDK_AAC_fuzzer-5397024709804032
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
-rw-r--r-- | libSBRdec/src/sbr_crc.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libSBRdec/src/sbr_crc.cpp b/libSBRdec/src/sbr_crc.cpp index ba0fd05..8a5282e 100644 --- a/libSBRdec/src/sbr_crc.cpp +++ b/libSBRdec/src/sbr_crc.cpp @@ -153,8 +153,10 @@ static int getCrc(HANDLE_FDK_BITSTREAM hBs, ULONG NrBits) { calcCRC(&CrcBuf, bValue, MAXCRCSTEP); } - bValue = FDKreadBits(hBs, CrcNrBitsRest); - calcCRC(&CrcBuf, bValue, CrcNrBitsRest); + if (CrcNrBitsRest > 0) { + bValue = FDKreadBits(hBs, CrcNrBitsRest); + calcCRC(&CrcBuf, bValue, CrcNrBitsRest); + } return (CrcBuf.crcState & SBR_CRC_RANGE); } |