1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-02-16 19:30:34 +01:00

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: 27624/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBFDK_AAC_fuzzer-6049277318791168

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
This commit is contained in:
Martin Storsjo 2020-11-30 12:55:07 +02:00
parent a0411159e8
commit 2e64f76d2e

View File

@ -914,7 +914,7 @@ static void _skipEqCoefficients(HANDLE_FDK_BITSTREAM hBs) {
firFilterOrder; firFilterOrder;
int uniqueEqSubbandGainsCount, eqSubbandGainRepresentation, int uniqueEqSubbandGainsCount, eqSubbandGainRepresentation,
eqSubbandGainCount; eqSubbandGainCount;
EQ_SUBBAND_GAIN_FORMAT eqSubbandGainFormat; int eqSubbandGainFormat;
eqDelayMaxPresent = FDKreadBits(hBs, 1); eqDelayMaxPresent = FDKreadBits(hBs, 1);
if (eqDelayMaxPresent) { if (eqDelayMaxPresent) {
@ -955,7 +955,7 @@ static void _skipEqCoefficients(HANDLE_FDK_BITSTREAM hBs) {
uniqueEqSubbandGainsCount = FDKreadBits(hBs, 6); uniqueEqSubbandGainsCount = FDKreadBits(hBs, 6);
if (uniqueEqSubbandGainsCount > 0) { if (uniqueEqSubbandGainsCount > 0) {
eqSubbandGainRepresentation = FDKreadBits(hBs, 1); eqSubbandGainRepresentation = FDKreadBits(hBs, 1);
eqSubbandGainFormat = (EQ_SUBBAND_GAIN_FORMAT)FDKreadBits(hBs, 4); eqSubbandGainFormat = FDKreadBits(hBs, 4);
switch (eqSubbandGainFormat) { switch (eqSubbandGainFormat) {
case GF_QMF32: case GF_QMF32:
eqSubbandGainCount = 32; eqSubbandGainCount = 32;