Skip to content

Fix segfault when going up steep slopes in rare cases

Hanicef requested to merge Hanicef/SRB2:fix-null-standingslope into next

In a few rare cases, it's possible for the game to crash when going up steep slopes. This happens because of NULL dereference within P_GetWallTransferMomZ, where a check that verifies if a slope have physics set or not. On that check, the code incorrectly checks mo->standingslope instead of the slope variable, where the former has a risk of being NULL. The callee site already checks that NULL value and uses oldslope as a fallback, which is what slope is being set to: https://git.do.srb2.org/STJr/SRB2/-/blob/next/src/p_mobj.c#L1906-L1911

Merge request reports

Loading