From 0e5aee48aaa983eb6eca512dbf3f4efd34645ca8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 30 Jan 2017 22:23:36 +0100 Subject: [PATCH] - clamp MAPINFO provided fog density values to a valid range because negative values can trigger undefined shader behavior. --- src/gl/data/gl_data.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index d386428a2a..bb73ad3aeb 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -413,7 +413,7 @@ void InitGLRMapinfoData() if (opt != NULL) { - gl_SetFogParams(opt->fogdensity, level.info->outsidefog, opt->outsidefogdensity, opt->skyfog); + gl_SetFogParams(clamp(opt->fogdensity, 0, 255), level.info->outsidefog, clamp(opt->outsidefogdensity, 0, 255), opt->skyfog); glset.map_lightmode = opt->lightmode; glset.map_lightadditivesurfaces = opt->lightadditivesurfaces; glset.map_attenuate = opt->attenuate;