Skip to content

setLowLODElement might crash if LLOD Element is Building #5196

Description

@PlatinMTA

Describe the bug

This didn't happen before r26804. Basically doing something like:

local b = createBuilding(5427, 2170.9765625, -1461.125, 25.0859375, 0, 0, 0, 0)
local bLOD = createBuilding(5581, 2170.9765625, -1461.125, 25.0859375, 0, 0, 0, 0)
setLowLODElement(b, bLOD)

Could crash a client. I say could because I was able to reproduce it just fine while loading a custom gamemode, but then I just couldn't reproduce it by using runcode. Anyways setLowLODElement is not intended to work with buildings, you need to use an object instead, but it shouldn't crash either. Maybe a warning would be nice.

Created buildings can have LOD models. The procedure is as follows: spawn the LOD building using createBuilding, then use setLowLODElement to associate it with the non-LOD building element you created beforehand. LOD model distance changed with engineSetModelLODDistance works for buildings.

Doing it the intended way yields no crashes

local b = createBuilding(5427, 2170.9765625, -1461.125, 25.0859375, 0, 0, 0, 0)
local bLOD = createObject(5581, 2170.9765625, -1461.125, 25.0859375, 0, 0, 0, true)
setLowLODElement(b, bLOD)

Steps to reproduce

local b = createBuilding(5427, 2170.9765625, -1461.125, 25.0859375, 0, 0, 0, 0)
local bLOD = createBuilding(5581, 2170.9765625, -1461.125, 25.0859375, 0, 0, 0, 0)
setLowLODElement(b, bLOD)

This may crash your client.

Version

Client: Multi Theft Auto v1.7-untested-26804

Additional context

https://discord.com/channels/801330706252038164/1289708691830083775/1538727847982534739

Relevant log output

Version = 1.7-untested-26804.0.000
Time = Mon Aug 17 03:46:00 2026
Module = C:\Program Files (x86)\MTA San Andreas 1.7\mods\deathmatch\client.dll
Code = 0xC0000005
Offset = 0x00034C9B

EAX=00000000  EBX=4728FDE0  ECX=00000000  EDX=700C8858  ESI=4728FDE0
EDI=00000000  EBP=0177F49C  ESP=0177F490  EIP=6FD54C9B  FLG=00010246
CS=0023   DS=002B  SS=002B  ES=002B   FS=0053  GS=002B

InvalidParameterCount = 0
CrashZone = 0
ThreadId = 4872


Precise crash time: 2026-08-17 03:46:00.314
Exception Type: SEH:AccessViolation
Exception: Access Violation - Invalid memory access
Resolved Module Path: C:\Program Files (x86)\MTA San Andreas 1.7\mods\deathmatch\client.dll
Resolved Module Base: client.dll
Resolved Module Offset: 0x00034C9B
Additional Info: Allocation telemetry: requested=0 bytes (no tagged context available)
CrashTelemetry::Scope annotations: none executed on this thread before crash; instrument entry points to capture context.

Fatal Exception: Yes
Stack trace:
  client.dll+0x34C9B [0x6FD54C9B]
  client.dll+0x34C45 [0x6FD54C45]
  client.dll+0x110169 [0x6FE30169]
  client.dll+0x181959 [0x6FEA1959]
  client.dll+0x18294B [0x6FEA294B]
  client.dll+0x181398 [0x6FEA1398]
  client.dll+0x26EBE0 [0x6FF8EBE0]
  client.dll+0x280763 [0x6FFA0763]
  client.dll+0x26E5EC [0x6FF8E5EC]
  client.dll+0x264843 [0x6FF84843]
  client.dll+0x26EDB8 [0x6FF8EDB8]
  client.dll+0x26E780 [0x6FF8E780]
  client.dll+0x265460 [0x6FF85460]
  client.dll+0x13940F [0x6FE5940F]
  client.dll+0x11F0A7 [0x6FE3F0A7]
  client.dll+0x22D0FB [0x6FF4D0FB]
  client.dll+0x13A92E [0x6FE5A92E]
  client.dll+0x137629 [0x6FE57629]
  client.dll+0x5394C [0x6FD7394C]
  client.dll+0x52A11 [0x6FD72A11]
  core.dll+0xAAB6D [0x7445AB6D]
  core.dll+0x127C1A [0x744D7C1A]
  core.dll+0x1390F7 [0x744E90F7]
  gta_sa.exe+0x3F9B12 [0x7F9B12]
  gta_sa.exe+0x3FB1C3 [0x7FB1C3]


Reason: Access Violation - Invalid memory access at client.dll+0x00034C9B (ThreadId=4872)

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions