Fix client crash when loading malformed IFP animation data#5047
Open
HeresHavi wants to merge 1 commit into
Open
Fix client crash when loading malformed IFP animation data#5047HeresHavi wants to merge 1 commit into
HeresHavi wants to merge 1 commit into
Conversation
Validate ANP2 and ANP3 animation metadata and buffer bounds before parsing to prevent malformed IFP files from causing client crashes.
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
Added ANP2 and ANP3 validation before constructing animation hierarchies.
Malformed animation counts, object counts, frame counts, frame types, truncated headers, and missing frame data now return
false. Allocation failures during the initial animation resize are also handled safely.Motivation
CClientIFP::ReadIFPVersion2passed the signedTotalAnimationsvalue directly tostd::vector::resize. A value of-1became an extremely large unsigned size and caused an uncaughtstd::length_errorto terminate the client.For example, a resource might load a custom animation file downloaded with a character pack. If the file is corrupted or has an invalid animation count, simply calling
engineLoadIFPcould crash the player before the animation was even applied.The validation runs once when the IFP is loaded and does not add work to animation playback.
Crash Stack
Test plan
Runtime
TotalAnimations = -1caused an uncaughtstd::length_errorand terminated the client.false, and the client stayed open.false.TotalObjects = -1returnedfalse.false.Builds and Tests
Debug | Win32: Full build passed, 304 client tests passed.Release | Win32: Full build passed, 304 client tests passed.Debug | x64: Full build passed.Release | x64: Full build passed.clang-format.Checklist