From 5e60c3c956f3d6c1860277c30d4c175d6e23e928 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 22ffe27968..58471dda15 100644 --- a/ref/soft/r_draw.c +++ b/ref/soft/r_draw.c @@ -95,7 +95,11 @@ void R_DrawStretchPicImplementation( int x, int y, int w, int h, int s1, int t1, //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;