From 4b3273b2292be5d2b2c795a9196a5ddd83958406 Mon Sep 17 00:00:00 2001 From: Kaelan Date: Tue, 15 Oct 2024 19:37:16 -0600 Subject: [PATCH] Add bounds check --- src/gamedata/r_defs.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gamedata/r_defs.h b/src/gamedata/r_defs.h index bf0f6be4b..e940d80ab 100644 --- a/src/gamedata/r_defs.h +++ b/src/gamedata/r_defs.h @@ -40,6 +40,7 @@ #include "r_sky.h" #include "p_terrain.h" #include "p_effect.h" +#include "vm.h" #include "hwrenderer/data/buffers.h" @@ -1031,11 +1032,13 @@ public: void SetPlaneReflectivity(int pos, double val) { + if (pos < 0 || pos > 1) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "pos must be either 0 or 1"); reflect[pos] = val; } double GetPlaneReflectivity(int pos) { + if (pos < 0 || pos > 1) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "pos must be either 0 or 1"); return reflect[pos]; }