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
This commit is contained in:
Martin Storsjo 2020-11-17 12:15:20 +02:00
parent 3a831a5fbc
commit 4e944af756
1 changed files with 4 additions and 2 deletions

View File

@ -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);
}