mirror of
https://github.com/raysan5/raylib.git
synced 2026-06-27 21:40:29 +00:00
[rlgl] Fix matrix stack overflow in rlPushMatrix() (#5935)
The RL_MAX_MATRIX_STACK_SIZE check logged an error but did not return, so RLGL.State.stack[stackCounter] = *currentMatrix still executed when the stack was full -- writing one element past stack[RL_MAX_MATRIX_STACK_SIZE] and corrupting the adjacent RLGL.State members (stackCounter, etc.). rlPopMatrix() already guards the symmetric underflow case; add the missing early return. Co-authored-by: Brandon Arrendondo <brandon.arrendondo@bissell.com>
This commit is contained in:
committed by
GitHub
parent
d1a14bee5d
commit
83cb4cc210
@@ -1237,7 +1237,11 @@ void rlMatrixMode(int mode)
|
||||
// Push the current matrix into RLGL.State.stack
|
||||
void rlPushMatrix(void)
|
||||
{
|
||||
if (RLGL.State.stackCounter >= RL_MAX_MATRIX_STACK_SIZE) TRACELOG(RL_LOG_ERROR, "RLGL: Matrix stack overflow (RL_MAX_MATRIX_STACK_SIZE)");
|
||||
if (RLGL.State.stackCounter >= RL_MAX_MATRIX_STACK_SIZE)
|
||||
{
|
||||
TRACELOG(RL_LOG_ERROR, "RLGL: Matrix stack overflow (RL_MAX_MATRIX_STACK_SIZE)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (RLGL.State.currentMatrixMode == RL_MODELVIEW)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user