-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(gta-streaming-five): sanitize ragdoll component based in attach bone #3186
base: master
Are you sure you want to change the base?
Conversation
The index is used a few times before this in the same function. |
This is the code looking for the pattern of the fail location: auto location = hook::get_pattern("48 8B 91 ? ? ? ? 48 8D 8D");
hook::nop(location, 7);
const auto successPtr = reinterpret_cast<intptr_t>(location) + 7;
const auto failPtr = reinterpret_cast<intptr_t>(hook::get_pattern("4C 8D 85 ? ? ? ? E8 ? ? ? ? 4C 8D 9C 24 ? ? ? ? 49 8B 5B ? 41 0F 28 73", 12));
trace("CPedWeaponManager::SwitchToRagdoll: %lld\n", static_cast<long long>(failPtr - reinterpret_cast<intptr_t>(location))); // 1375
patchStub.Init(successPtr, failPtr);
hook::jump(location, patchStub.GetCode()); But I didn't understand the assert, do you mean something like this? assert((failPtr - reinterpret_cast<intptr_t>(location)) < 2000); |
Yeah, that's fine. |
Oh right, I mean return right after reading the index, |
bea5663
to
457519b
Compare
It should be good now, tested and seems to be working as expected |
When will it be updated |
Goal of this PR
Validate that the component obtained from the attachment index is not -1, which represents an invalid position in the component array.
There are some peds that don't have the same attachment bones as the common ones and when the ragdoll is activated with a weapon it causes it to crash near people.
How is this PR achieving the goal
Patching a part of the
CPedWeaponManager::SwitchToRagdoll
function to validate that ther13
register representing the component value is not -1.This PR applies to the following area(s)
FiveM
Successfully tested on
Game builds: 1, 1604, 3407
Platforms: Windows
Checklist
Fixes issues
fixes #3185