Thread Tools Display Modes
09-02-08, 09:31 AM   #1
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
WotLK: build 8885 taint issues (UIDropDownMenu)

Reposting from my wowace post.
Since these forums are frequented by both EU and US addon developers maybe it will reach the all-elusive 'devs'.
The issue affects many of the addons in the beta category here
(practically any that call UIDropDownMenu_Initialize at some point)

The taint.log posted further down is quite self-explanatory if you follow the line numbers and look at the FrameXML\ files referenced.

It seems that in the recent 3.0.2 (8885) beta build any addon that calls
Code:
UIDropDownMenu_Initialize(frame, initfunc, ...)
causes action blocked errors due to taint.

Steps to reproduce:
1. Load an addon that uses UIDropDownMenu_Initialize and take whatever action is required for the function to be called
(show an options screen etc)
2. Right-click the target frame and choose "Set Focus"
Similar issues with "Clear Focus".

Both setfocus and clearfocus work without issue if you use keybinds and not the dropdown menu.

Typical taint.log contains:
Code:
Global variable UIDROPDOWNMENU_INIT_MENU tainted by _ _ _ _ _ 
Interface\FrameXML\UIDropDownMenu.lua:30 UIDropDownMenu_Initialize()
...
Execution tainted by _ _ _ _ _ while reading UIDROPDOWNMENU_INIT_MENU - 
Interface\FrameXML\UnitPopup.lua:997 func()
...
An action was blocked because of taint from _ _ _ _ _ - FocusUnit()
Interface\FrameXML\UnitPopup.lua:1181 func()
Several addons are giving me those messages.
Those that initialize the dropdown in OnLoad handlers are blamed first.
If you go on disabling, other addons take their place after they call UIDropDownMenu_Initialize
(in OnShow handlers for example)

Haven't found a workaround sofar or a mention on UI & Macros forum so
I don't know if this is expected behavior we're supposed to circumvent somehow.

Edit: Addons in question use local variables btw (self not this) and the action blocked errors
happen regardless of combat status (both when trying to setfocus and showing dropdowns)
ie you'll get them even if you haven't entered combat at all.
  Reply With Quote
09-02-08, 09:44 AM   #2
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
Reposting my own observation that this has been reported in the UI and Macros forum as of 01/27/2008 (http://forums.worldofwarcraft.com/th...sid=1&pageNo=2), involving a different kind of taint (target of target frame not showing) which is caused by the simple fact that an init function is attempting to create more menu items than the number of menu item buttons that the game has already created. It's certainly still reproducible with the new focus frame, but ultimately it doesn't give us a solution
  Reply With Quote
10-17-08, 01:16 PM   #3
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
I'm bumping this in the hopes that either some blue will accidentally see it and perhaps report it, or even better, someone will post about it on the US, UI & Macros forum (I'm an EU subscriber so I can't). It's a very annoying issue, affects a LOT of addons at the moment, as we had expected and we are wasting tons of time reiterating the same response to our users that repeatedly ask why our addons are "breaking" their focus frame.
  Reply With Quote
10-25-08, 10:11 AM   #4
Telic
A Defias Bandit
 
Telic's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2005
Posts: 3
More Causes & Some Solutions

Many AddOns seem to have caused a problem with the Set Focus and Clear Focus drop down menu actions.
Here is a summary of what I've found while 'adjusting' my AddOns to cope with this issue :


TAINT THROUGH ADDON DROP DOWN INITIALISATION / ADDBUTTON
-----------------------------------------------------------------
As defined by UIDropDownMenu.lua, the default number of menu buttons is 8 and the default number of menu frames is 2.
(i.e. a depth of 2 menus)
As larger menus are initialised, UIDropDownMenu creates buttons and menus as required, and stores the numbers created in
UIDROPDOWNMENU_MAXBUTTONS - the number of menu buttons created.
UIDROPDOWNMENU_MAXLEVELS - the number of menu frames created. i.e. opening one drop down from another

When you log in, Blizzard UI code exectues, and these numbers naturally (and securely) increase.
Blizzard UI code and AddOns initialise many drop downs when you log in, so that by the time you are able to execute scripts at the command line, the number of drop down buttons on WotLK Beta is 24.

If ANY AddOn initialises a drop down box that increases either UIDROPDOWNMENU_MAXBUTTONS or UIDROPDOWNMENU_MAXLEVELS beyond the value it has securely reached via Blizzard code, then taint is introduced and Set focus and Clear focus drop down action buttons are blocked.

If you initialise AddOn drop down boxes in their OnLoad functions, then you can very easily introduce taint, as you may cause an increase in the secure number of buttons BEFORE Blizzard's secure code has reached the 'relatively' high value of 24.

If you initialise AddOn drop down boxes in their safer OnShow function, then you usually won't introduce taint as long as it has less than 25 buttons, and only has a menu depth of 2. More than 24 buttons, or a menu depth of 3 or more will cause taint.

There is a sneaky way to increase UIDROPDOWNMENU_MAXBUTTONS to a maximum of 29 without causing taint by using the following code :

Code:
	if ( UIDROPDOWNMENU_MAXBUTTONS < 29 ) then
		local toggle;
		if ( not WorldMapFrame:IsVisible() ) then
			ToggleFrame(WorldMapFrame);
			toggle = true;
		end
		SetMapZoom(2);
		if ( toggle ) then
			ToggleFrame(WorldMapFrame);
		end
	end
This code causes the Eastern Kingdoms zone list to load in the World Map zone drop down, and although you have triggered it from an AddOn, it increases UIDROPDOWNMENU_MAXBUTTONS to 29 without causing taint. Useful if you have a drop down box of your own that needs to list the Eastern Kingdom zones, or any other drop down with 24 to 29 buttons
i.e. execute the above code before initialising your own drop down, and then the buttons up to 29 are securely pre-made for you. Not quite enough for the Atlas maximum buttons, but nearly.

(Note that the above code couldn't be executed in the 'VARIABLES_LOADED' event on WotLK Beta without causing a Blizzard Feedback AddOn error, so needs to be executed in an OnUpdate after VARIABLES_LOADED.)

I'm not sure there's a secure way to increase the menu depth to 3, or the number of buttons beyond 29.
(Although Blizzard could certainly increase their minimum values and save a lot of trouble without even having to investigate why the taint was happening; At the cost of a small amount of memory obviously)



TAINT BY HOOKING
-------------------
If you hook the 'WorldMapFrame_Update' function when UIDROPDOWNMENU_MAXBUTTONS equals 24 (or less), and then open the World Map and go to Eastern Kingdoms to increase the value to 29, then you will have tainted the drop down boxes, as WorldMapFrame_Update was tainted by your hook when the drop down buttons were created.

This means that many of the world map functions that didn't previously need to be hooked securely, now do, to be on the safe side.



TAINT BY BUTTON INSERTION IN TO UnitPopup MENUS
----------------------------------------------------
If you want to add options to the target frame right click menu by adding button information to the UnitPopup.lua arrays, then you will cause taint.
I haven't found any secure way of adding your own buttons to these menus.



TAINT EVEN WHEN YOU THINK ITS SAFE
---------------------------------------
In certain conditions I have found a bug where you can cause taint even though the number of buttons in your menu is LESS than UIDROPDOWNMENU_MAXBUTTONS.

Menus store the number of buttons used in a value associated with the menu frame e.g. DropDownList1.numButtons
When you call UIDropDownMenu_Initialize, the numButtons value should be zeroed, and then incremented each time you AddButton.
However, testing on the WotLK Beta, I have found that this value is sometimes NOT reset to zero, leading to the your buttons being added to the number of buttons included in the previous menu, and therefore leading to the possibility of exceeding UIDROPDOWNMENU_MAXBUTTONS, and causing taint.
The exact cause has been difficult to pin down, but it seems like its happening occasionally when one drop down list is already open when you try to initialise another, possibly when one of the drop downs is deeper than level 1, or when UIDROPDOWNMENU_OPEN_MENU hasn't been updated correctly.

There does seem to be a safe way to avoid this in your own initialisation script, by explicitly resetting .numButtons to zero in your own code - which does NOT seem to lead to taint.
For example, when opening a level 1 drop down list, you can explicitly reset the value :

DropDownList1.numButtons = 0;



COMBAT_TEXT_X_SCALE TAINT
-------------------------------
There is at least one other cause of Set Focus / Clear Focus taint that occurs occasionally, but I haven't pinned down what really causes it.
It reports a taint log saying that COMBAT_TEXT_X_SCALE is tainted in Blizzard_CombatText.lua, finally resulting in the same Focus action blocked.

In this case the taint seems temporary and short lived, and a second attempt to Set Focus or Clear Focus will succeed.
(So I haven't investigated further atm)
  Reply With Quote
10-25-08, 10:33 AM   #5
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
Great findings Telic.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » WotLK: build 8885 taint issues (UIDropDownMenu)


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off