Skip to content

fix(gta-core-five): guard vertex pool pop against stale head pointer …#3821

Open
st860923 wants to merge 1 commit intocitizenfx:masterfrom
st860923:fix/vertex-pool-crash
Open

fix(gta-core-five): guard vertex pool pop against stale head pointer …#3821
st860923 wants to merge 1 commit intocitizenfx:masterfrom
st860923:fix/vertex-pool-crash

Conversation

@st860923
Copy link
Copy Markdown

@st860923 st860923 commented Feb 10, 2026

Goal of this PR

Fix a crash that occurs on servers with many players when multiple peds are being rendered simultaneously.
This is a widely reported crash across many servers and has been the # 1 crash on my server.
image

How is this PR achieving the goal

The vertex pool uses a lock-free pop with CMPXCHG16B. A TOCTOU race allows another thread to pop and reuse a slot before the first thread dereferences the head pointer, causing it to read vertex data instead of a valid next pointer. This results in a non-canonical address dereference.

So I validate the head pointer before the dereference (bit 47 check). If stale, we jump back to the top of the existing CAS retry loop which is matching the original retry-on-failure semantics instead of crashing.
And I try to pattern scanning with no hardcoded offsets in case future build have another match.

This PR applies to the following area(s)

FiveM

Successfully tested on

Game builds: v3095, v3258, v3717
Platforms: Windows

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

GTA5_b3258.exe!sub_1416BEE88 (0x5e), GTA5_b3095.exe!sub_1416A8D60 (0x5e)
3258 user report in discord
3095 user report in discord

@github-actions github-actions Bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Requires changes before it's considered valid and can be (re)triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant