Skip to content

fix(Callback): guard UnitName() calls against secret string values in UNIT_SPELLCAST_SENT#49

Open
rcaril wants to merge 1 commit intovoidzone:mainfrom
rcaril:fix-unit-spellcast-sent-private-aura
Open

fix(Callback): guard UnitName() calls against secret string values in UNIT_SPELLCAST_SENT#49
rcaril wants to merge 1 commit intovoidzone:mainfrom
rcaril:fix-unit-spellcast-sent-private-aura

Conversation

@rcaril
Copy link

@rcaril rcaril commented Mar 9, 2026

Description:

This PR fixes LUA errors calling during the UNIT_SPELLCAST_SENT event due to calling UnitName() without checking if the value is protected. We check for various common scenarios - if any call would be a protected value, nil is returned to fail gracefully and avoid a LUA error.

Validation:

I tested this fix in game and can confirm LUA errors are no longer thrown for any scenario.

… UNIT_SPELLCAST_SENT

  In PvP contexts (arenas, BGs), UnitName() can return a secret/protected                                                         string value. Comparing these against regular strings causes a Lua error:
  attempt to compare a secret string value (tainted by 'Gnosis').

  The existing issecretvalue() guard only checked the event arguments (unit,
  target), not the return values of subsequent UnitName() calls. Store each
  UnitName() result and check issecretvalue() before comparing, covering both
  the rangeCheckTarget block (unit == player) and the class-detection block.

  Fixes errors when casting spells at focus/targettarget units with
  PvP-protected names.
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