diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index f8c55965e0925d9383233ecd70cbb0ff69ebc9e0..91ce389e7ed97705b15e06941a4916ff3632feca 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -401,6 +401,12 @@ UINT32 HWR_Lighting(INT32 light, UINT32 color, UINT32 fadecolor, boolean fogbloc
 
 	(void)fogblockpoly;
 
+	// Don't go out of bounds
+	if (light < 0)
+		light = 0;
+	else if (light > 255)
+		light = 255;
+
 	realcolor.rgba = color;
 	fogcolor.rgba = fadecolor;
 
@@ -488,6 +494,12 @@ static UINT8 HWR_FogBlockAlpha(INT32 light, UINT32 color, UINT32 fadecolor) // L
 	RGBA_t realcolor, fogcolor, surfcolor;
 	INT32 alpha, fogalpha;
 
+	// Don't go out of bounds
+	if (light < 0)
+		light = 0;
+	else if (light > 255)
+		light = 255;
+
 	realcolor.rgba = color;
 	fogcolor.rgba = fadecolor;