Fix client crash on oversized building pool resize#5046
Open
HeresHavi wants to merge 1 commit into
Open
Conversation
Prevent oversized engineSetPoolCapacity requests from leaving the building pool in a partially replaced state. Validate capacities before destructive lifecycle work, guard allocation-size calculations, and allocate all replacement pool storage before freeing the active GTA pool. Allocation failures now return safely without leaving stale world pointers or removing the game world.
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 upper-bound and allocation checks to building pool resizing.
Replacement storage is now allocated before the active GTA pool is freed. Failed resize requests return
falsewithout removing the world or leaving stale building pointers behind.Motivation
An oversized
engineSetPoolCapacityrequest could remove the game world and free the active building pool before all replacement allocations had succeeded. If a later allocation failed, the rollback path could not safely repair existing world references.For example, a resource might increase the building pool for a large custom map. If its capacity calculation produces an extremely large value, the old resize path could leave roads and buildings missing or crash the player's client during the next world update.
The fix rejects sizes that cannot fit GTA's signed pool capacity and handles allocation failures before changing the active pool.
Crash Stack
Test plan
Runtime
13000to13001, then restored it to13000. Both calls returnedtrue.2147483648raisedvector too longafter removing the world. Roads and buildings disappeared even though the capacity still reported13000.200000000left stale world pointers and caused an access violation during a later GTA update.false, retained capacity13000, and the client stayed open.Builds and Tests
Debug | Win32: Build passed, 304 client tests passed.Release | Win32: Build passed, 304 client tests passed.Debug | x64: Build passed.Release | x64: Build passed.clang-format.Checklist