From 4a296b33615df0cbe27c1535aca92bf3e0382738 Mon Sep 17 00:00:00 2001 From: myT Date: Tue, 12 Dec 2017 22:08:12 +0100 Subject: [PATCH] fixed a memory overflow due to GL_PACK_ALIGNMENT not being set correctly --- changelog.txt | 3 +++ code/renderer/tr_init.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/changelog.txt b/changelog.txt index ffa601c..a157112 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,9 @@ DD Mmm 17 - 1.49 +fix: taking screenshots with a render width (r_width) that wasn't a multiple of 4 + would either crash or produce bad screenshots + fix: false positives of the "SCR_UpdateScreen: recursively called" fatal error repro: connect, get kicked, connect, get kicked diff --git a/code/renderer/tr_init.cpp b/code/renderer/tr_init.cpp index aced339..07e7d9c 100644 --- a/code/renderer/tr_init.cpp +++ b/code/renderer/tr_init.cpp @@ -167,6 +167,11 @@ static void GL_SetDefaultState() qglEnable( GL_SCISSOR_TEST ); qglDisable( GL_CULL_FACE ); qglDisable( GL_BLEND ); + + // Needed for some of our qglReadPixels calls. + // The default alignment is 4. + // RGB with width 1366 -> not a multiple of 4! + qglPixelStorei( GL_PACK_ALIGNMENT, 1 ); }