From 3acb78f88d0c7577ed69b61982e53bcd0994f35a Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Fri, 24 May 2024 14:35:12 -0500 Subject: [PATCH] RENDERER: Fix opengl1/OpenGL2 crash in levelshot command Setting packAlign was removed [1] and later set to 0 [2] and this caused PADP( ..., 0 ) to return NULL which later gets passed to R_GammaCorrect() and crashed. It seems I left packAlign in my PNG/levelshot changes [3] even though it's not needed in R_LevelShot(). Set packAlign to 1 which is single byte alignment and doesn't allocate additional memory. PADP( ..., 1 ) returns the same address and it doesn't crash later. 1: b514a01b461719904182d62d57554ca7e2c5971a 2: 688f4f50dd091f6f5f5368be8576c8f8f03a99a6 3: https://github.com/ioquake/ioq3/pull/262 --- code/renderergl1/tr_init.c | 2 +- code/renderergl2/tr_init.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/renderergl1/tr_init.c b/code/renderergl1/tr_init.c index 1e79886be..7f73da205 100644 --- a/code/renderergl1/tr_init.c +++ b/code/renderergl1/tr_init.c @@ -488,7 +488,7 @@ static void R_LevelShot(screenshotType_e type, const char *ext) { size_t offset = 0, memcount; int spadlen, rpadlen; int padwidth, linelen; - GLint packAlign = 0; + GLint packAlign = 1; byte *src, *dst; int x, y; int r, g, b; diff --git a/code/renderergl2/tr_init.c b/code/renderergl2/tr_init.c index 87644d8e7..96cb93111 100644 --- a/code/renderergl2/tr_init.c +++ b/code/renderergl2/tr_init.c @@ -577,7 +577,7 @@ static void R_LevelShot(screenshotType_e type, const char *ext) { size_t offset = 0, memcount; int spadlen, rpadlen; int padwidth, linelen; - GLint packAlign = 0; + GLint packAlign = 1; byte *src, *dst; int x, y; int r, g, b;