Skip to content

fix: Guard BodyModule access in StealthUpdate::allowedToStealth - #566

Open
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/client-4zv-stealth-null-ptr
Open

fix: Guard BodyModule access in StealthUpdate::allowedToStealth#566
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/client-4zv-stealth-null-ptr

Conversation

@seer-by-sentry

Copy link
Copy Markdown

This PR addresses issue CLIENT-4ZV, which was an EXCEPTION_ACCESS_VIOLATION_READ at 0x0 in StealthUpdate::allowedToStealth.

The root cause was identified as a NULL pointer dereference when self->getBodyModule() returned NULL for objects lacking a BodyModule, and getLastDamageTimestamp() was called on the resulting NULL pointer. Additionally, a potential secondary NULL dereference was identified if getBodyModule()->getLastDamageInfo() returned NULL (which it does for base BodyModule implementations).

The fix involves:

  1. Caching the result of self->getBodyModule() into a local pointer (body).
  2. Adding a NULL check for body before attempting to call body->getLastDamageTimestamp() in the STEALTH_NOT_WHILE_TAKING_DAMAGE condition.
  3. Adding a NULL check for body->getLastDamageInfo() before dereferencing it, to prevent crashes for objects with non-ActiveBody modules.

These changes ensure that getLastDamageTimestamp() and getLastDamageInfo() are only called on valid BodyModuleInterface pointers.

Fixes CLIENT-4ZV

This PR was automatically generated by Sentry. You can adjust this setting at any time.

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.

0 participants