From 37c54d7abe9243bd1c7c8c55adf2d6d8425edc0f Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 5 Nov 2025 22:53:10 +0100 Subject: [PATCH] R_AllocClippingTables & R_AllocTextureColumnTables: fix nullptr arithmetic --- src/r_segs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_segs.cpp b/src/r_segs.cpp index d1cbbf9c2..414221686 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -1718,7 +1718,7 @@ static void R_AllocClippingTables(size_t range) { // Check if it's in range of the openings #define CHECK(which) \ - if (which + drawseg->x1 >= oldopenings && which + drawseg->x1 <= oldlast) \ + if (which != NULL && which + drawseg->x1 >= oldopenings && which + drawseg->x1 <= oldlast) \ which = (which - oldopenings) + openings CHECK(drawseg->sprtopclip); CHECK(drawseg->sprbottomclip); @@ -1752,7 +1752,7 @@ static void R_AllocTextureColumnTables(size_t range) { // Check if it's in range of the tables #define CHECK(which) \ - if (which + drawseg->x1 >= oldtable && which + drawseg->x1 <= oldlast) \ + if (which != NULL && which + drawseg->x1 >= oldtable && which + drawseg->x1 <= oldlast) \ which = (which - oldtable) + texturecolumntable CHECK(drawseg->maskedtexturecol); CHECK(drawseg->thicksidecol);