Fix: Tainting UIMenus and CloseMenus() #10


  • Defect
  • Fixed
Closed
  • DahkCeles created this issue Mar 9, 2021

    The game menu micro button is getting tainted, because it calls CloseMenus() which depends on UIMenus being secure.

     

    Reference: https://www.townlong-yak.com/framexml/live/UIParent.lua#3699

     

     

    I have already found a possible fix, in bold below.

     

    -- //////////////////////////////////////////////////////////////
    -- Handling two frames from LibUIDropDownMenu.xml
    local function create_DropDownButtons()
    L_DropDownList1 = creatre_DropDownList("L_DropDownList1")
    L_DropDownList1:SetToplevel(true)
    L_DropDownList1:SetFrameStrata("FULLSCREEN_DIALOG")
    L_DropDownList1:Hide()
    L_DropDownList1:SetID(1)
    L_DropDownList1:SetSize(180, 10)
    local _, fontHeight, _ = _G["L_DropDownList1Button1NormalText"]:GetFont()
    L_UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = fontHeight

    L_DropDownList2 = creatre_DropDownList("L_DropDownList2")
    L_DropDownList2:SetToplevel(true)
    L_DropDownList2:SetFrameStrata("FULLSCREEN_DIALOG")
    L_DropDownList2:Hide()
    L_DropDownList2:SetID(2)
    L_DropDownList2:SetSize(180, 10)

    -- UIParent integration; since we customize the name of DropDownList, we need to add it to golbal UIMenus table.
    --tinsert(UIMenus, "L_DropDownList1");
    --tinsert(UIMenus, "L_DropDownList2");

    -- Alternative by Dahk Celes (DDC) that avoids tainting UIMenus and CloseMenus()
    hooksecurefunc("CloseMenus", function()
    L_DropDownList1:Hide()
    L_DropDownList2:Hide()
    end)
    end

    do
    if lib then
    create_DropDownButtons()
    end
    end
  • DahkCeles added a tag Defect Mar 9, 2021
  • arithmandar posted a comment May 18, 2021

    Thanks for the codes, this has been added to the new release.

  • arithmandar added a tag Fixed May 18, 2021
  • DahkCeles closed issue May 18, 2021

To post a comment, please login or register a new account.