I randomly found this bug at like 4am when i was working on a script for a friend
Client: canary; FXVersion: 5848
To get a error or smth took a bit to find the problem
Game crash
Native
Client example code that causes this crash:
CreateThread(function()
while true do
DrawMarker("crash", 1693.0, 4822.0, 42.0, 0, 0, 0, 0, 0, 0, 1.0, 1.0, 1.0, 255, 0, 0, 200, false, true, 2, false, nil, nil, false)
Wait(0)
end
end)
Screenshot of the crashcode:
1 Like
_4iY
May 25, 2024, 6:01pm
2
TBF itâs clearly marked that it needs to be an integer in the natives reference, I donât see this being an âactual bugâ, although pretty weird - I donât recall a lot of natives causing a crash like that for passing the wrong data type to it.
1 Like
_4iY:
TBF itâs clearly marked that it needs to be an integer in the natives reference, I donât see this being an âactual bugâ, although pretty weird - I donât recall a lot of natives causing a crash like that for passing the wrong data type to it.
A string passed as an integer transforms into a large integer, which is an invalid index for a marker type. I will fix it soon. The game shouldnât crash when you call a native, even if it was called with invalid arguments.
2 Likes
Created a pull request with the fix:
citizenfx:master
â Disquse:fivem/draw-marker-fix
opened 11:00AM - 26 May 24 UTC
### Goal of this PR
Using an invalid marker type index will cause an OOB cr⌠ash. This PR is meant to fix this issue.
### How is this PR achieving the goal
By replacing the original native handler with one that includes marker type index checks.
### This PR applies to the following area(s)
FiveM, Natives
### Successfully tested on
**Game builds:** 1604, 2060, 2189, 2372, 2545, 2612, 2699, 2802, 2944, 3095
**Platforms:** Windows, Linux
### Checklist
- [x] Code compiles and has been tested successfully.
- [x] Code explains itself well and/or is documented.
- [x] My commit message explains what the changes do and what they are for.
- [x] No extra compilation warnings are added by these changes.
### Fixes issues
Addresses the problem reported in this forum topic:
https://forum.cfx.re/t/drawmarker-causing-crash-when-you-enter-a-string-as-type-instead-of-a-integer/5236598
2 Likes