From 49ed7ae4a001a5d84141f65064081cce3c136137 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Tue, 8 Nov 2022 16:54:42 -0600 Subject: [PATCH] Rebase against 13cc08e32d6c04f8f915d07cda39638ee99c3d43. --- patches/patchinstall.sh | 18 +-- ...ct-CloseThemeData-from-invalid-input.patch | 115 ------------------ patches/uxtheme-CloseThemeClass/definition | 1 - patches/uxtheme-GTK_Theming/definition | 1 - staging/upstream-commit | 2 +- 5 files changed, 2 insertions(+), 135 deletions(-) delete mode 100644 patches/uxtheme-CloseThemeClass/0001-uxtheme-Protect-CloseThemeData-from-invalid-input.patch delete mode 100644 patches/uxtheme-CloseThemeClass/definition diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 7bfb4608..1e01129c 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "1d636da205e39436bbd71849ceeebc5420bf98a9" + echo "13cc08e32d6c04f8f915d07cda39638ee99c3d43" } # Show version information @@ -204,7 +204,6 @@ patch_enable_all () enable_user32_rawinput_mouse="$1" enable_user32_rawinput_mouse_experimental="$1" enable_user32_recursive_activation="$1" - enable_uxtheme_CloseThemeClass="$1" enable_version_VerQueryValue="$1" enable_wbemdisp_ISWbemObject_Invoke="$1" enable_widl_SLTG_Typelib_Support="$1" @@ -628,9 +627,6 @@ patch_enable () user32-recursive-activation) enable_user32_recursive_activation="$2" ;; - uxtheme-CloseThemeClass) - enable_uxtheme_CloseThemeClass="$2" - ;; version-VerQueryValue) enable_version_VerQueryValue="$2" ;; @@ -3115,18 +3111,6 @@ if test "$enable_user32_recursive_activation" -eq 1; then patch_apply user32-recursive-activation/0002-user32-tests-Test-a-recursive-activation-loop-on-WM_.patch fi -# Patchset uxtheme-CloseThemeClass -# | -# | This patchset fixes the following Wine bugs: -# | * [#41729] Protect CloseThemeData() from invalid input -# | -# | Modified files: -# | * dlls/uxtheme/msstyles.c, dlls/uxtheme/msstyles.h, dlls/uxtheme/tests/system.c -# | -if test "$enable_uxtheme_CloseThemeClass" -eq 1; then - patch_apply uxtheme-CloseThemeClass/0001-uxtheme-Protect-CloseThemeData-from-invalid-input.patch -fi - # Patchset version-VerQueryValue # | # | Modified files: diff --git a/patches/uxtheme-CloseThemeClass/0001-uxtheme-Protect-CloseThemeData-from-invalid-input.patch b/patches/uxtheme-CloseThemeClass/0001-uxtheme-Protect-CloseThemeData-from-invalid-input.patch deleted file mode 100644 index 496ed1ba..00000000 --- a/patches/uxtheme-CloseThemeClass/0001-uxtheme-Protect-CloseThemeData-from-invalid-input.patch +++ /dev/null @@ -1,115 +0,0 @@ -From ef1c68c88caa4b4edfce72ad7fed38a4e23a56d1 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Fri, 18 Nov 2016 22:31:29 +0800 -Subject: [PATCH] uxtheme: Protect CloseThemeData() from invalid input. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Testcase by Michael Müller . ---- - dlls/uxtheme/msstyles.c | 22 ++++++++++++++++++++++ - dlls/uxtheme/msstyles.h | 3 ++- - dlls/uxtheme/tests/system.c | 4 ++++ - 3 files changed, 28 insertions(+), 1 deletion(-) - -diff --git a/dlls/uxtheme/msstyles.c b/dlls/uxtheme/msstyles.c -index 9e5a79a1c69..18c675214d9 100644 ---- a/dlls/uxtheme/msstyles.c -+++ b/dlls/uxtheme/msstyles.c -@@ -32,6 +32,7 @@ - - #include "msstyles.h" - -+#include "wine/exception.h" - #include "wine/debug.h" - #include "wine/heap.h" - -@@ -49,6 +50,8 @@ static HRESULT MSSTYLES_GetFont (LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPC - - #define MSSTYLES_VERSION 0x0003 - -+#define THEME_CLASS_SIGNATURE (('T' << 24) | ('H' << 16) | ('E' << 8) | 'M') -+ - static PTHEME_FILE tfActiveTheme; - - /***********************************************************************/ -@@ -204,6 +207,7 @@ void MSSTYLES_CloseThemeFile(PTHEME_FILE tf) - pcls->partstate = ps->next; - heap_free(ps); - } -+ pcls->signature = 0; - heap_free(pcls); - } - } -@@ -442,6 +446,7 @@ static PTHEME_CLASS MSSTYLES_AddClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWST - if(cur) return cur; - - cur = heap_alloc(sizeof(*cur)); -+ cur->signature = THEME_CLASS_SIGNATURE; - cur->hTheme = tf->hTheme; - lstrcpyW(cur->szAppName, pszAppName); - lstrcpyW(cur->szClassName, pszClassName); -@@ -1075,6 +1080,23 @@ PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList, U - */ - HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc) - { -+ __TRY -+ { -+ if (tc->signature != THEME_CLASS_SIGNATURE) -+ tc = NULL; -+ } -+ __EXCEPT_PAGE_FAULT -+ { -+ tc = NULL; -+ } -+ __ENDTRY -+ -+ if (!tc) -+ { -+ WARN("Invalid theme class handle\n"); -+ return E_HANDLE; -+ } -+ - MSSTYLES_CloseThemeFile (tc->tf); - return S_OK; - } -diff --git a/dlls/uxtheme/msstyles.h b/dlls/uxtheme/msstyles.h -index 67f81315d7a..9a65b7cb8a7 100644 ---- a/dlls/uxtheme/msstyles.h -+++ b/dlls/uxtheme/msstyles.h -@@ -49,6 +49,7 @@ typedef struct _THEME_PARTSTATE { - struct _THEME_FILE; - - typedef struct _THEME_CLASS { -+ DWORD signature; - HMODULE hTheme; - struct _THEME_FILE* tf; - WCHAR szAppName[MAX_THEME_APP_NAME]; -@@ -64,7 +65,7 @@ typedef struct _THEME_IMAGE { - WCHAR name[MAX_PATH]; - HBITMAP image; - BOOL hasAlpha; -- -+ - struct _THEME_IMAGE *next; - } THEME_IMAGE, *PTHEME_IMAGE; - -diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c -index 93b6f1aa8f7..2e3a323f96c 100644 ---- a/dlls/uxtheme/tests/system.c -+++ b/dlls/uxtheme/tests/system.c -@@ -528,6 +528,10 @@ static void test_OpenThemeData(void) - ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected 0x%08lx, got 0x%08lx\n", - E_PROP_ID_UNSUPPORTED, GetLastError() ); - -+ /* Close invalid handle */ -+ hRes = CloseThemeData((HTHEME)0xdeadbeef); -+ ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08lx\n", hRes); -+ - if (!bThemeActive) - { - SetLastError(0xdeadbeef); --- -2.35.1 - diff --git a/patches/uxtheme-CloseThemeClass/definition b/patches/uxtheme-CloseThemeClass/definition deleted file mode 100644 index 965bd113..00000000 --- a/patches/uxtheme-CloseThemeClass/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [41729] Protect CloseThemeData() from invalid input diff --git a/patches/uxtheme-GTK_Theming/definition b/patches/uxtheme-GTK_Theming/definition index 216933bf..1aa92cf4 100644 --- a/patches/uxtheme-GTK_Theming/definition +++ b/patches/uxtheme-GTK_Theming/definition @@ -1,5 +1,4 @@ # based on https://github.com/akulinchev/uxthemegtk # sha1: ecbca8e848834180092d9078be0762a60617fcd7 -Depends: uxtheme-CloseThemeClass Disabled: True Fixes: Add support for GTK3 theming diff --git a/staging/upstream-commit b/staging/upstream-commit index 46612236..50e91142 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -1d636da205e39436bbd71849ceeebc5420bf98a9 +13cc08e32d6c04f8f915d07cda39638ee99c3d43