Skip to content

Commit afaad42

Browse files
author
mergetest
committed
Fix secret-value taint spam in SafeSetFont + click-cast takeover of non-unit buttons
SafeSetFont's font-family re-render read GetText() and compared it with ~= "" — a value comparison on what is a SECRET string for native cooldown countdown text (and health text) in instanced PvP. The pcall hid the error but every blocked compare logged a taint incident, hundreds per minute (bugs #987/#988). Truthiness is the sanctioned test and GetText() returns nil for empty text, so the comparison was redundant. ClickCastFrames handling gets an eligibility gate: only Button/Frame entries carrying a unit attribute are registered, so non-unit secure buttons (ToyPicker's toy button) no longer have their click attributes rewritten. Also fixes the RegisterAllFrames sweep precedence bug (enabled and A or B) that re-registered explicitly disabled entries.
1 parent 1775945 commit afaad42

3 files changed

Lines changed: 37 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* (Click Casting) **Fixed keyboard and extra-mouse-button hover binds dying addon-wide mid-combat until a /reload** — hover binds are now owned by one permanent frame instead of the unit frame under the cursor, removing the cleanup step that could hit a dead frame reference and silently break every later hover. The 4.7.2 after-the-fact self-repair stays as a safety net, but the cause is gone. (by Krathe)
88
* (Click Casting) Fixed keyboard and mouse-wheel click-cast binds being silently dropped mid-hover during combat — the safety check that removes hover binds could misread the cursor as off the frame while the frame's position was briefly unreadable, wiping the binds until the frame was re-hovered. Binds are now only removed when the cursor is provably off the frame. (by Krathe)
99
* (Click Casting) Fixed binds on keys from international keyboard layouts (such as æ, ø or å) not casting on the frame under the cursor.
10+
* (Auras) Fixed a stream of blocked-action taint warnings in PvP instances (triggered while styling aura duration text) that could spill over and break Blizzard's chat or other addons until a /reload.
11+
* (Click Casting) Frames that other addons register for click-casting are now only taken over if they are real unit frames — non-unit buttons (such as toy or action buttons) are left alone, and frames an addon explicitly unregisters stay unregistered.
1012

1113
### New Features
1214

ClickCasting/Frames.lua

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,25 @@ end
732732
-- CLICKCASTFRAMES GLOBAL TABLE
733733
-- ============================================================
734734

735+
-- A ClickCastFrames entry is only click-castable if it is an actual unit
736+
-- frame: a Button/Frame carrying a "unit" attribute. Registration rewrites the
737+
-- frame's click attributes to DF's macro/target actions, which BREAKS any
738+
-- non-unit secure button that lands in the global table — a toy/action button
739+
-- has no unit and can't receive unit-targeted casts anyway (bug #988,
740+
-- ToyPicker's button had its type1 replaced). Frames whose unit is assigned
741+
-- late (secure header children) are picked up by the next RegisterAllFrames
742+
-- sweep once the attribute exists.
743+
local function clickCastFrameEligible(frame)
744+
if type(frame) ~= "table" or not frame.GetObjectType or not frame.GetAttribute then
745+
return false
746+
end
747+
local objType = frame:GetObjectType()
748+
if objType ~= "Button" and objType ~= "Frame" then return false end
749+
local unit = frame:GetAttribute("unit")
750+
if issecretvalue(unit) then return false end
751+
return unit ~= nil
752+
end
753+
735754
function CC:SetupClickCastFramesGlobal()
736755
-- If our click casting is disabled, DON'T set up our metatable
737756
-- This allows Clique/Clicked to set up their own metatable and work normally
@@ -765,7 +784,7 @@ function CC:SetupClickCastFramesGlobal()
765784
if CC.db and CC.db.enabled then
766785
if enabled == nil or enabled == false then
767786
CC:UnregisterFrame(frame)
768-
else
787+
elseif clickCastFrameEligible(frame) then
769788
CC:RegisterFrame(frame)
770789
end
771790
end
@@ -853,7 +872,7 @@ function CC:ScanForThirdPartyFrames()
853872
-- Also scan ClickCastFrames in case something was added via rawset
854873
if ClickCastFrames then
855874
for frame, enabled in pairs(ClickCastFrames) do
856-
if enabled and type(frame) == "table" and not self.registeredFrames[frame] then
875+
if enabled and not self.registeredFrames[frame] and clickCastFrameEligible(frame) then
857876
self:RegisterFrame(frame)
858877
registered = registered + 1
859878
end
@@ -2059,10 +2078,14 @@ function CC:RegisterAllFrames()
20592078
end
20602079
end
20612080

2062-
-- Also check ClickCastFrames global (for third-party addon support)
2081+
-- Also check ClickCastFrames global (for third-party addon support).
2082+
-- NOTE: the old condition here was `enabled and A or B` — precedence made
2083+
-- it (enabled and Button) or Frame, so entries an addon explicitly
2084+
-- DISABLED (ClickCastFrames[f] = false, the documented unregister method)
2085+
-- were re-registered on every sweep if their object type was "Frame".
20632086
if ClickCastFrames then
20642087
for frame, enabled in pairs(ClickCastFrames) do
2065-
if enabled and frame:GetObjectType() == "Button" or frame:GetObjectType() == "Frame" then
2088+
if enabled and clickCastFrameEligible(frame) then
20662089
self:RegisterFrame(frame)
20672090
end
20682091
end

Config.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -766,11 +766,16 @@ function DF:SafeSetFont(fontString, fontNameOrPath, fontSize, outline)
766766
-- Force WoW to re-render the text with new font properties
767767
-- This is needed because switching between font families with different outline flags
768768
-- may not immediately update the rendered text without a text refresh
769-
-- Note: Some fontStrings have "secret" text that cannot be read or compared,
770-
-- so we wrap this in pcall to handle those cases safely
769+
-- Note: the text may be a SECRET string (native cooldown countdown
770+
-- text, health text, ...). Truthiness on a secret is allowed, but a
771+
-- value comparison (~= "") is BLOCKED — and even inside pcall each
772+
-- blocked compare logs a DandersFrames taint incident (hundreds per
773+
-- minute in PvP instances; bugs #987/#988). GetText() returns nil,
774+
-- never "", for empty text, so truthiness is also the complete
775+
-- check. SetText accepts secret strings, so the round trip is safe.
771776
pcall(function()
772777
local text = fontString:GetText()
773-
if text and text ~= "" then
778+
if text then
774779
fontString:SetText("")
775780
fontString:SetText(text)
776781
end

0 commit comments

Comments
 (0)