From ae7ed03376b860def9b5d70090dfc6c9e5444159 Mon Sep 17 00:00:00 2001 From: mittorn Date: Tue, 31 Oct 2023 04:05:13 +0300 Subject: [PATCH] ref_soft: fix crash when y < -height --- ref/soft/r_draw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ref/soft/r_draw.c b/ref/soft/r_draw.c index 3f91dc6b..5b3d60c0 100644 --- a/ref/soft/r_draw.c +++ b/ref/soft/r_draw.c @@ -95,7 +95,11 @@ static void R_DrawStretchPicImplementation( int x, int y, int w, int h, int s1, //gEngfuncs.Con_Printf ("pixels is %p\n", pic->pixels[0] ); height = h; - if (y < 0) + + if( y < -h ) // out of display, out of bounds + return; + + if( y < 0 ) { skip = -y; height += y;