From 6a2eb8b30f4a65d3b9b0422bf14eaf7007149ffd Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Thu, 4 Feb 2021 14:04:55 +0200 Subject: [PATCH] Avoid failing asserts on broken bitstreams Fixes: 29712/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBFDK_AAC_fuzzer-5347313432264704 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg --- libPCMutils/src/pcmdmx_lib.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libPCMutils/src/pcmdmx_lib.cpp b/libPCMutils/src/pcmdmx_lib.cpp index 2070dbc..534acad 100644 --- a/libPCMutils/src/pcmdmx_lib.cpp +++ b/libPCMutils/src/pcmdmx_lib.cpp @@ -583,6 +583,8 @@ static PCMDMX_ERROR getChannelMode( (channelType[ch] & 0x0F) - 1, 0); /* Assign all undefined channels (ACT_NONE) to front channels. */ + if (channelIndices[ch] >= numCh[channelType[ch] >> 4][chGrp]) + return PCMDMX_INVALID_CH_CONFIG; spkrPos[ch] = getSpeakerPos(channelType[ch], channelIndices[ch], numCh[channelType[ch] >> 4][chGrp]);