Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aleksandr Isakov
wine-fonts
Commits
9e23981a
Commit
9e23981a
authored
Nov 18, 2016
by
Dmitry Timoshkov
Committed by
Vitaly Lipatov
Jul 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uxtheme: Protect CloseThemeData() from invalid input.
Testcase by Michael Müller <michael@fds-team.de>.
parent
99abb4d0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
msstyles.c
dlls/uxtheme/msstyles.c
+22
-0
msstyles.h
dlls/uxtheme/msstyles.h
+2
-1
system.c
dlls/uxtheme/tests/system.c
+4
-0
No files found.
dlls/uxtheme/msstyles.c
View file @
9e23981a
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include "msstyles.h"
#include "msstyles.h"
#include "wine/exception.h"
#include "wine/debug.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/heap.h"
...
@@ -49,6 +50,8 @@ static HRESULT MSSTYLES_GetFont (LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPC
...
@@ -49,6 +50,8 @@ static HRESULT MSSTYLES_GetFont (LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPC
#define MSSTYLES_VERSION 0x0003
#define MSSTYLES_VERSION 0x0003
#define THEME_CLASS_SIGNATURE (('T' << 24) | ('H' << 16) | ('E' << 8) | 'M')
static
PTHEME_FILE
tfActiveTheme
;
static
PTHEME_FILE
tfActiveTheme
;
/***********************************************************************/
/***********************************************************************/
...
@@ -204,6 +207,7 @@ void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
...
@@ -204,6 +207,7 @@ void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
pcls
->
partstate
=
ps
->
next
;
pcls
->
partstate
=
ps
->
next
;
heap_free
(
ps
);
heap_free
(
ps
);
}
}
pcls
->
signature
=
0
;
heap_free
(
pcls
);
heap_free
(
pcls
);
}
}
}
}
...
@@ -442,6 +446,7 @@ static PTHEME_CLASS MSSTYLES_AddClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWST
...
@@ -442,6 +446,7 @@ static PTHEME_CLASS MSSTYLES_AddClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWST
if
(
cur
)
return
cur
;
if
(
cur
)
return
cur
;
cur
=
heap_alloc
(
sizeof
(
*
cur
));
cur
=
heap_alloc
(
sizeof
(
*
cur
));
cur
->
signature
=
THEME_CLASS_SIGNATURE
;
cur
->
hTheme
=
tf
->
hTheme
;
cur
->
hTheme
=
tf
->
hTheme
;
lstrcpyW
(
cur
->
szAppName
,
pszAppName
);
lstrcpyW
(
cur
->
szAppName
,
pszAppName
);
lstrcpyW
(
cur
->
szClassName
,
pszClassName
);
lstrcpyW
(
cur
->
szClassName
,
pszClassName
);
...
@@ -1075,6 +1080,23 @@ PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList, U
...
@@ -1075,6 +1080,23 @@ PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList, U
*/
*/
HRESULT
MSSTYLES_CloseThemeClass
(
PTHEME_CLASS
tc
)
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
);
MSSTYLES_CloseThemeFile
(
tc
->
tf
);
return
S_OK
;
return
S_OK
;
}
}
...
...
dlls/uxtheme/msstyles.h
View file @
9e23981a
...
@@ -49,6 +49,7 @@ typedef struct _THEME_PARTSTATE {
...
@@ -49,6 +49,7 @@ typedef struct _THEME_PARTSTATE {
struct
_THEME_FILE
;
struct
_THEME_FILE
;
typedef
struct
_THEME_CLASS
{
typedef
struct
_THEME_CLASS
{
DWORD
signature
;
HMODULE
hTheme
;
HMODULE
hTheme
;
struct
_THEME_FILE
*
tf
;
struct
_THEME_FILE
*
tf
;
WCHAR
szAppName
[
MAX_THEME_APP_NAME
];
WCHAR
szAppName
[
MAX_THEME_APP_NAME
];
...
@@ -64,7 +65,7 @@ typedef struct _THEME_IMAGE {
...
@@ -64,7 +65,7 @@ typedef struct _THEME_IMAGE {
WCHAR
name
[
MAX_PATH
];
WCHAR
name
[
MAX_PATH
];
HBITMAP
image
;
HBITMAP
image
;
BOOL
hasAlpha
;
BOOL
hasAlpha
;
struct
_THEME_IMAGE
*
next
;
struct
_THEME_IMAGE
*
next
;
}
THEME_IMAGE
,
*
PTHEME_IMAGE
;
}
THEME_IMAGE
,
*
PTHEME_IMAGE
;
...
...
dlls/uxtheme/tests/system.c
View file @
9e23981a
...
@@ -539,6 +539,10 @@ static void test_OpenThemeData(void)
...
@@ -539,6 +539,10 @@ static void test_OpenThemeData(void)
ok
(
GetLastError
()
==
E_PROP_ID_UNSUPPORTED
,
"Expected 0x%08lx, got 0x%08lx
\n
"
,
ok
(
GetLastError
()
==
E_PROP_ID_UNSUPPORTED
,
"Expected 0x%08lx, got 0x%08lx
\n
"
,
E_PROP_ID_UNSUPPORTED
,
GetLastError
()
);
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
)
if
(
!
bThemeActive
)
{
{
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment