From c69efe581740fa69f28643dc70c295774798bd8d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 25 Jul 2021 12:43:42 +0200 Subject: [PATCH] - fix crash issue with empty VOCs. Pointer to empty data causes undefined behavior if length is 0. --- source/common/audio/sound/i_sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/audio/sound/i_sound.cpp b/source/common/audio/sound/i_sound.cpp index 9e60cc155..5f828d985 100644 --- a/source/common/audio/sound/i_sound.cpp +++ b/source/common/audio/sound/i_sound.cpp @@ -450,7 +450,7 @@ SoundHandle SoundRenderer::LoadSoundVoc(uint8_t *sfxdata, int length) } // Second pass to write the data - if (okay) + if (okay && len > 0) { data = new uint8_t[len]; i = 26;