From 39df580e06dadedd509ef316698eab3801aa2ac6 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 21 Oct 2025 19:24:56 +0200 Subject: [PATCH] fix R_MakeSpans accessing "spanstart" out of bounds when in splitscreen it gets allocated for viewheight not vid.height! --- src/r_plane.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 543faec77..8ef47f722 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -616,14 +616,12 @@ void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop) // static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(drawspandata_t*), INT32, INT32, INT32, boolean), spandrawfunc_t* localspanfunc, drawspandata_t* ds, INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2, boolean allow_parallel) { - const INT32 vidheight = vid.height; - // Alam: from r_splats's R_RenderFloorSplat - if (t1 >= vidheight) t1 = vidheight-1; - if (b1 >= vidheight) b1 = vidheight-1; - if (t2 >= vidheight) t2 = vidheight-1; - if (b2 >= vidheight) b2 = vidheight-1; - if (x-1 >= vid.width) x = vid.width; + if (t1 >= viewheight) t1 = viewheight-1; + if (b1 >= viewheight) b1 = viewheight-1; + if (t2 >= viewheight) t2 = viewheight-1; + if (b2 >= viewheight) b2 = viewheight-1; + if (x-1 >= viewwidth) x = viewwidth; #ifdef HAVE_THREADS // We want to draw N spans per subtask to ensure the work is