From d1bbd1261e7f3b3dbdbbe9951ae007fa120d0df0 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Mon, 15 May 2017 15:36:51 +0100
Subject: [PATCH] VID_SetMode: SDLSetMode should use vid.width/vid.height, not
 windowedModes[modeNum].

If modenum was < 0 or >= MAXWINMODES, that would make windowedModes[modeNum] be out of bounds and possibly crash the game.
---
 src/sdl/i_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c
index 73bbe8acd0..43a293ae56 100644
--- a/src/sdl/i_video.c
+++ b/src/sdl/i_video.c
@@ -1188,7 +1188,7 @@ INT32 VID_SetMode(INT32 modeNum)
 	}
 	Impl_SetWindowName("SRB2 "VERSIONSTRING);
 
-	SDLSetMode(windowedModes[modeNum][0], windowedModes[modeNum][1], USE_FULLSCREEN);
+	SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
 
 	if (render_soft == rendermode)
 	{
-- 
GitLab