Commit 0f7294b
authored
Fix collision UAF on paired time models (#4864)
#### Summary
- Fix timed model collision restore desync that can leave dangling
`pColModel` pointers and crash in `CCollision::TestLineSphere` at
`0x4174B6`.
- Stop using GTA paired propagation in this path and sync paired TIME
model collision state explicitly in MTA tracking.
#### Motivation
- This is a long standing latent bug: after multiple model/COL
replacements, reconnect is not enough and collision state can stay
corrupted until full game restart.
- Blame target for the broken behavior:
`34b4a61d40b39e0f21f42ccf031d37439223fa12` (`Resolve remaining
collisionless objects (Fixes #927) (PR #2296)`), which used paired
`SetColModel(..., true)` without mirrored MTA tracking for the paired
model.
- Related but incomplete fix: `c1824033c2e56db105730ed1cb0a06d7f720c042`
(`Fix timed-object collision crash (#4782)`), which handled one path
only.
#### Test plan
- Repro sequence with two paired TIME models and two resources
replacing/restoring COL in different order no longer leaves freed
pointers bound.
- Crash map/session hop flow that previously reached
`gta_sa.exe+0x174B6` no longer crashes in local validation run.
- Non TIME model COL replacement/restore behavior stays unchanged.
#### Checklist
* [x] Your code should follow the [coding
guidelines](https://wiki.multitheftauto.com/index.php?title=Coding_guidelines).
* [x] Smaller pull requests are easier to review. If your pull request
is beefy, your pull request should be reviewable commit-by-commit.1 parent 9c3737d commit 0f7294b
1 file changed
Lines changed: 72 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1594 | 1594 | | |
1595 | 1595 | | |
1596 | 1596 | | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
1597 | 1600 | | |
1598 | 1601 | | |
| 1602 | + | |
| 1603 | + | |
1599 | 1604 | | |
1600 | 1605 | | |
1601 | 1606 | | |
| |||
1619 | 1624 | | |
1620 | 1625 | | |
1621 | 1626 | | |
1622 | | - | |
| 1627 | + | |
1623 | 1628 | | |
1624 | 1629 | | |
1625 | 1630 | | |
| |||
1645 | 1650 | | |
1646 | 1651 | | |
1647 | 1652 | | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
1648 | 1684 | | |
1649 | 1685 | | |
1650 | 1686 | | |
| |||
1655 | 1691 | | |
1656 | 1692 | | |
1657 | 1693 | | |
1658 | | - | |
| 1694 | + | |
1659 | 1695 | | |
1660 | 1696 | | |
1661 | 1697 | | |
1662 | 1698 | | |
1663 | 1699 | | |
1664 | 1700 | | |
1665 | | - | |
| 1701 | + | |
1666 | 1702 | | |
1667 | 1703 | | |
1668 | 1704 | | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
1669 | 1738 | | |
1670 | 1739 | | |
1671 | 1740 | | |
| |||
0 commit comments