From 9ca2819ad1638bd9a4c48ffe2a36e478f18fd01f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 12 Jan 2020 09:32:30 +0100 Subject: [PATCH] - added missing validation to S_GetUserFlags functions. --- source/duke3d/src/sounds.cpp | 1 + source/rr/src/sounds.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/source/duke3d/src/sounds.cpp b/source/duke3d/src/sounds.cpp index f0740f0c4..a2b0e84e1 100644 --- a/source/duke3d/src/sounds.cpp +++ b/source/duke3d/src/sounds.cpp @@ -114,6 +114,7 @@ float S_ConvertPitch(int lpitch) int S_GetUserFlags(int num) { + if (!soundEngine->isValidSoundId(num+1)) return 0; auto const* snd = (sound_t*)soundEngine->GetUserData(num + 1); if (!snd) return 0; return snd->flags; diff --git a/source/rr/src/sounds.cpp b/source/rr/src/sounds.cpp index cf997333d..206e20995 100644 --- a/source/rr/src/sounds.cpp +++ b/source/rr/src/sounds.cpp @@ -113,6 +113,7 @@ float S_ConvertPitch(int lpitch) int S_GetUserFlags(int num) { + if (!soundEngine->isValidSoundId(num+1)) return 0; auto const* snd = (sound_t*)soundEngine->GetUserData(num + 1); if (!snd) return 0; return snd->flags;