From c8f4c37c88f9e2ba702600419514f19fa6d83344 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 25 Mar 2021 18:38:36 -0700 Subject: [PATCH] Add bounds check for color of createentity number 55 I just spotted this one - if vy isn't bounds-checked, this causes bogus input from the createentity() script command to commit Undefined Behavior. Should've spotted this one when I was adding bounds checks to the rest of createentity() earlier, but at least it's fixed now. --- desktop_version/src/Entity.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index 4f779a5f..c86e03aa 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -2005,7 +2005,8 @@ void entityclass::createentity( float xp, float yp, int t, float vx /*= 0*/, flo //2 - colour entity.rule = 3; entity.type = 55; - if(customcrewmoods[int(vy)]==1){ + if(INBOUNDS_ARR((int) vy, customcrewmoods) + && customcrewmoods[int(vy)]==1){ entity.tile = 144; }else{ entity.tile = 0;