Repository navigation
Conversation
SUnoccupiedVehicleSync::Read previously ignored return values from SPositionSync, SRotationDegreesSync, SVelocitySync, SVehicleHealthSync, and trailer ID reads, allowing out-of-bounds positions, non-finite velocities, or truncated fields to pass as valid. Validate each read in SUnoccupiedVehicleSync::Read and reject invalid entries in CUnoccupiedVehicleSyncPacket::Read instead of continuing on corrupted data. Value-initialize data in SUnoccupiedVehicleSync's constructor as well (the previous 1-byte write missed the 9th bitfield bit bIsInWater and remaining scalar fields). Add unit tests in SyncVehicle_Tests.cpp covering initialization, full round-trips, out-of-bounds positions, non-finite velocities, and truncated streams.
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
Check the return value of every sub-structure read (
SPositionSync,SRotationDegreesSync,SVelocitySync,SVehicleHealthSync, and trailerElementID) insideSUnoccupiedVehicleSync::Read, reject failed entries inCUnoccupiedVehicleSyncPacket::Readinstead of continuing on out-of-sync streams, and value-initializeSUnoccupiedVehicleSync::datain its constructor.Motivation
SUnoccupiedVehicleSync::Readpreviously discarded sub-structureRead()failures, so out-of-bounds/non-finite positions caught bySPositionSync, non-finite velocities caught bySVelocitySync, or truncated fields still propagated as valid sync updates. The constructor's 1-byte zeroing (*((char*)&data) = 0) also left the 9th bitfield bit (bIsInWater) and scalar fields uninitialized.Test plan
Built
DeathmatchandTests_Client(Release Win32), verified formatting withclang-format, and ranTests_Client.exe(318 tests passing, including 5 newSUnoccupiedVehicleSyncunit tests covering initialization, full round-trips, out-of-bounds Z position,NaNvelocity, and truncated streams).Checklist