From 90cc5a6cb0cf0f210d2a8c3518dbe73c429b29ff Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Mon, 4 Sep 2023 15:30:21 +0200 Subject: [PATCH 1/3] Fix a possible crash in R_RenderMaskedSegRange https://git.do.srb2.org/STJr/SRB2/-/commit/55b4458001b2ffe76774ff07a11b56ebf1f70de9 --- src/r_segs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/r_segs.c b/src/r_segs.c index 594024b75..53f12ecc6 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1769,6 +1769,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) while (need > maxopenings); openings = Z_Realloc(openings, maxopenings * sizeof (*openings), PU_STATIC, NULL); lastopening = openings + pos; + + if (oldopenings == NULL) + return; // borrowed fix from *cough* zdoom *cough* // [RH] We also need to adjust the openings pointers that From 7da590df94863e0d18451f194923849e49d384ab Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Mon, 4 Sep 2023 15:30:42 +0200 Subject: [PATCH 2/3] Fix sprite scale column iteration crash https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2130 --- src/r_things.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/r_things.c b/src/r_things.c index 26dad2f0b..b1c4c3851 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -851,6 +851,15 @@ static void R_DrawVisSprite(vissprite_t *vis) if (overflow_test < 0) overflow_test = -overflow_test; if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) return; // ditto } + + // TODO This check should not be necessary. But Papersprites near to the camera will sometimes create invalid values + // for the vissprite's startfrac. This happens because they are not depth culled like other sprites. + // Someone who is more familiar with papersprites pls check and try to fix <3 + if (vis->startfrac < 0 || vis->startfrac > (patch->width << FRACBITS)) + { + // never draw vissprites with startfrac out of patch range + return; + } colfunc = basecolfunc; // hack: this isn't resetting properly somewhere. dc_colormap = vis->colormap; From 98dfe528d8b46662c57ed910544d5308345058f8 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Mon, 4 Sep 2023 16:37:11 +0200 Subject: [PATCH 3/3] remove this --- src/r_things.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/r_things.h b/src/r_things.h index ab4688f91..7e38dbf47 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -152,8 +152,6 @@ typedef struct vissprite_s extracolormap_t *extra_colormap; // global colormaps - //fixed_t xscale; - // Precalculated top and bottom screen coords for the sprite. fixed_t thingheight; // The actual height of the thing (for 3D floors) sector_t *sector; // The sector containing the thing.