Skip to content

Commit

Permalink
RENDERER: Fix opengl1/OpenGL2 crash in levelshot command
Browse files Browse the repository at this point in the history
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: b514a01
2: 688f4f5
3: ioquake/ioq3#262
  • Loading branch information
zturtleman committed May 24, 2024
1 parent 58517c3 commit 3acb78f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/renderergl1/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion code/renderergl2/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3acb78f

Please sign in to comment.