Repository navigation
[rlsw] Fix matrix stack underflow in swPopMatrix() - #6362
Conversation
The matrix stack counters start at 1 for their initial matrices. Reject pops when the counter is <= 1 to prevent out-of-bounds access and correctly report SW_STACK_UNDERFLOW.
|
hey @raysan5, just following up on this PR, it's a pretty small fix, could you pls review? thanks for your time. |
|
@Bigfoot71 it looks good to me, despite the apparently AI generated issue, but please, could you take a second look to confirm merge? |
|
hi @raysan5 , just following up again on this PR, it's a very small patch, and i've rewritten the issue as well in simpler terms. please can you have a look again. thanks for your time. |
|
@shadye-6 please, don't insist, PRs could take from weeks to months to be reviewed and merged, if merged. This is an open source project. |
|
@raysan5 Thanks for the ping, reviewed on my end, the fix is correct, it can be merged. Related note, I just noticed that Lines 4078 to 4088 in 985ac29 It looks like a placeholder that was never completed, it should return the stack counter for each stack. |
|
@Bigfoot71 thanks for the review! Merging!
Yes, please. |
Summary
Fix matrix stack underflow in
swPopMatrix()for all three matrix modes insrc/external/rlsw.h. problem described in issue.Closes #6361
Solution
changed the underflow checks for all three matrix stacks from <= 0 to <= 1, which prevents popping the initial matrix, sets
SW_STACK_UNDERFLOW, and preserves the existing matrix stack state.Testing
verified using a standalone
rlswtest harness compiled with Clang 18.1.3, ASan and UBSan.