Implement bulletsync validation checks across various components#4989
Open
QueryOfficial wants to merge 1 commit into
Open
Implement bulletsync validation checks across various components#4989QueryOfficial wants to merge 1 commit into
QueryOfficial wants to merge 1 commit into
Conversation
- Added validation for bullet sync geometry and damage in CNetAPI, CGame, and CPlayer classes to prevent invalid bullet sync packets. - Introduced a method in CPlayer to limit the rate of accepted bulletsync packets, enhancing anti-cheat measures. - Updated packet reading methods in CBulletsyncPacket and related classes to utilize new validation functions for improved integrity checks. - Refactored existing checks to leverage the new SyncBulletsyncValidation class for consistency and maintainability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds server-side bullet sync + weapon aim validation to stop forged or flooded bullet-sync packets from being relayed before main-thread checks run.
SyncBulletsyncValidation.h— geometry (origin, segment, impact), damage fields, NaN/Inf, degenerate segmentsCBulletsyncPacket,CSimBulletsyncPacket,CCustomWeaponBulletSyncPacketuse shared helpers for consistent checksCGame::Packet_Bulletsync/Packet_WeaponBulletsyncvalidate beforeonPlayerWeaponFireand relayCSimPlayerManager::HandleBulletSyncruns the same validation + rate limit before sim broadcast (fixes early relay crash)CPlayer::TryAcceptBulletsync()— max 25 bullet-sync packets / second per playerCNetAPI::ReadBulletsync,CClientPed::SetTargetTargetServer/mods/deathmatch/README.weapon-sync-guard.mdNo netcode protocol changes.
Motivation
Cheats hook client
SendBulletSyncand can:DamageDividierloops)onPlayerWeaponFirefires on the serverRoot cause: the sim thread relayed
PACKET_ID_PLAYER_BULLETSYNCbefore main-thread validation. Invalid packets reached nearby clients even whenCBulletsyncPacket::Read()later rejected them.This fix validates geometry and damage on both paths and drops packets before apply/relay. Rate limiting catches multi-packet spam per shot.
Test plan
Build this branch, use 2+ clients on a private test server.
Normal gameplay
onPlayerWeaponFirebehave as beforeAttack regression (requires bullet-sync cheat / test hook)
onPlayerWeaponFire: Event fires only for accepted packets; no crash-before-event regressionExpected results
onPlayerWeaponFireonly for valid, rate-limited packetsChecklist