Fix crash in R_PointToDist2 when passing -2147483648
So, here's a fun one: if any of the arguments to R_PointToDist2
is exactly -2147483648, the game crashes with a segfault. That's because 2147483648 cannot be represented as a 32-bit integer, and thus abs(-2147483648) == -2147483648
. What then causes the crash is a check that picks the largest value of the two arguments will then pick the wrong one, causing it to fetch a value beyond the size of tantoangle
and thus crash.
This can easily be reproduced by creating a Lua script containing this single line:
FixedHypot(-2147483648, 1572864) -- latter value doesn't matter, I'm just using what originally triggered the bug.
Merge request reports
Activity
Filter activity
added Bug label
mentioned in issue #996 (closed)
added 762 commits
-
cfb40d42...a68440c4 - 761 commits from branch
STJr:next
- 80a227d7 - Merge branch SRB2:next into fix-pointtodist-negative-abs
-
cfb40d42...a68440c4 - 761 commits from branch
mentioned in commit 03626bcc
Please register or sign in to reply