Skip to content

Fix crashes caused by malformed vehicle model replacements#5053

Open
HeresHavi wants to merge 1 commit into
multitheftauto:masterfrom
HeresHavi:fix-malformed-vehicle-model-crashes
Open

Fix crashes caused by malformed vehicle model replacements#5053
HeresHavi wants to merge 1 commit into
multitheftauto:masterfrom
HeresHavi:fix-malformed-vehicle-model-crashes

Conversation

@HeresHavi

@HeresHavi HeresHavi commented Jul 13, 2026

Copy link
Copy Markdown

Summary

Added checks for required model frames before applying custom vehicle replacements.

Bike and BMX replacements now require both wheel frames, while Vortex replacements require the left landing gear frame. Missing plane panel frames are also disabled safely.

Rejected replacements keep the previous working model active and are no longer retried whenever the model streams in.

Motivation

GTA expects certain vehicle types to contain specific model frames. A replacement DFF can load successfully while still missing the frames needed by the vehicle it replaces, causing a crash later when GTA creates or renders it.

For example, a server might use a modified Super GT model as a replacement for a bike or Vortex. When the vehicle streams in, or when a player fires a weapon nearby, GTA can try to use wheel or landing gear frames that do not exist and crash the player's client.

Crash Stacks
Exception: Access violation

CBike::SetupSuspensionLines
Offset: 0x002B8AC9
Bike replacement crash
Exception: Access violation

CMatrix::Attach
Offset: 0x0019BD39
Plane replacement crash

Test plan

Runtime

  • Before Fix: Reproduced both reported access violations with malformed vehicle replacements.
  • Train and Plane Cases: Tested all 6 train models and all 11 plane models using the modified Super GT replacement.
  • Bike Cases: Tested the modified Super GT replacement with all 13 bike models.
  • Vortex Case: Tested the modified Super GT replacement on Vortex while firing weapons nearby.
  • Plane Panel Case: Applied 22 repeated damage events to a malformed Rustler replacement without crashing.
  • Replacement State: Confirmed rejected replacements kept the previous working model active and restored it correctly.

Builds and Tests

  • Debug | Win32: Full build passed, 304 client tests passed.
  • Release | Win32: Full build passed, 304 client tests passed.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Prevent crashes from malformed vehicle replacements by validating required model frames, safely handling missing plane nodes, and preserving the previous replacement when a new one fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant