Skip to content

feat(gta-core-five): clamp vehicle entrypoint index#3817

Open
divocbn wants to merge 1 commit intocitizenfx:masterfrom
divocbn:feat/clamp-entrypoint-index
Open

feat(gta-core-five): clamp vehicle entrypoint index#3817
divocbn wants to merge 1 commit intocitizenfx:masterfrom
divocbn:feat/clamp-entrypoint-index

Conversation

@divocbn
Copy link

@divocbn divocbn commented Feb 7, 2026

Goal of this PR

Prevent a crash caused by cheaters sending invalid vehicle entry/exit point indices that are serialized and synchronized in cloned vehicle tasks.

How is this PR achieving the goal

This PR clamps the serialized target entry/exit point index for CTaskEnterVehicle and CTaskExitVehicle to the valid range defined by the vehicle model entry/exit points.

This PR applies to the following area(s)

FiveM

Successfully tested on

Game builds: 3258, 3570, 3717

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

@github-actions github-actions bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Feb 7, 2026
@st860923
Copy link

st860923 commented Feb 7, 2026

Should there be a guard for numEntryExitPoints == 0 before the clamp?
The game itself seem early-outs when the count is zero.

@divocbn
Copy link
Author

divocbn commented Feb 7, 2026

Should there be a guard for numEntryExitPoints == 0 before the clamp? The game itself seem early-outs when the count is zero.

Kinda sure that it should be right as is, especially because 2-seat vehicles has 0 numEntryExitPoints.
Also my proof-of-concept crasher isn't working after that fix, could you provide any screens

@st860923
Copy link

st860923 commented Feb 7, 2026

You're right. I traced through the downstream code and the function already guards against numEntryExitPoints == 0 by skipping the lookup loop entirely and returning false, so the value is never actually used. The fix works as intended. 👍

Copy link
Contributor

@radium-cfx radium-cfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Thank you!

@radium-cfx radium-cfx added ready-to-merge This PR is enqueued for merging and removed invalid Requires changes before it's considered valid and can be (re)triaged labels Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR is enqueued for merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants