Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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
wine
wine-cw
Commits
f5f633e7
Commit
f5f633e7
authored
Sep 14, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Sep 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Validate the filter window handle in get_message.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7c768d90
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
msg.c
dlls/user32/tests/msg.c
+42
-0
queue.c
server/queue.c
+6
-0
No files found.
dlls/user32/tests/msg.c
View file @
f5f633e7
...
...
@@ -12173,6 +12173,31 @@ todo_wine {
qstatus
=
GetQueueStatus
(
qs_all_input
);
ok
(
qstatus
==
0
,
"wrong qstatus %08x
\n
"
,
qstatus
);
}
PostThreadMessageA
(
GetCurrentThreadId
(),
WM_USER
,
0
,
0
);
ret
=
PeekMessageA
(
&
msg
,
(
HWND
)
-
1
,
0
,
0
,
PM_NOREMOVE
);
ok
(
ret
==
TRUE
,
"wrong ret %d
\n
"
,
ret
);
ok
(
msg
.
message
==
WM_USER
,
"wrong message %u
\n
"
,
msg
.
message
);
ret
=
GetMessageA
(
&
msg
,
(
HWND
)
-
1
,
0
,
0
);
ok
(
ret
==
TRUE
,
"wrong ret %d
\n
"
,
ret
);
ok
(
msg
.
message
==
WM_USER
,
"wrong message %u
\n
"
,
msg
.
message
);
PostThreadMessageA
(
GetCurrentThreadId
(),
WM_USER
,
0
,
0
);
ret
=
PeekMessageA
(
&
msg
,
(
HWND
)
1
,
0
,
0
,
PM_NOREMOVE
);
ok
(
ret
==
TRUE
,
"wrong ret %d
\n
"
,
ret
);
ok
(
msg
.
message
==
WM_USER
,
"wrong message %u
\n
"
,
msg
.
message
);
ret
=
GetMessageA
(
&
msg
,
(
HWND
)
1
,
0
,
0
);
ok
(
ret
==
TRUE
,
"wrong ret %d
\n
"
,
ret
);
ok
(
msg
.
message
==
WM_USER
,
"wrong message %u
\n
"
,
msg
.
message
);
PostThreadMessageA
(
GetCurrentThreadId
(),
WM_USER
,
0
,
0
);
ret
=
PeekMessageA
(
&
msg
,
(
HWND
)
0xffff
,
0
,
0
,
PM_NOREMOVE
);
ok
(
ret
==
TRUE
,
"wrong ret %d
\n
"
,
ret
);
ok
(
msg
.
message
==
WM_USER
,
"wrong message %u
\n
"
,
msg
.
message
);
ret
=
GetMessageA
(
&
msg
,
(
HWND
)
0xffff
,
0
,
0
);
ok
(
ret
==
TRUE
,
"wrong ret %d
\n
"
,
ret
);
ok
(
msg
.
message
==
WM_USER
,
"wrong message %u
\n
"
,
msg
.
message
);
done:
trace
(
"signalling to exit
\n
"
);
SetEvent
(
info
.
hevent
[
EV_STOP
]);
...
...
@@ -17666,6 +17691,22 @@ done:
DestroyWindow
(
hwnd
);
}
static
void
test_invalid_window
(
void
)
{
MSG
msg
;
BOOL
ret
;
SetLastError
(
0xdeadbeef
);
ret
=
GetMessageA
(
&
msg
,
(
HWND
)
0xdeadbeef
,
0
,
0
);
ok
(
ret
==
-
1
,
"wrong ret %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_WINDOW_HANDLE
,
"wrong error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
PeekMessageA
(
&
msg
,
(
HWND
)
0xdeadbeef
,
0
,
0
,
PM_REMOVE
);
ok
(
!
ret
,
"wrong ret %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_WINDOW_HANDLE
,
"wrong error %u
\n
"
,
GetLastError
());
}
static
void
init_funcs
(
void
)
{
HMODULE
hKernel32
=
GetModuleHandleA
(
"kernel32.dll"
);
...
...
@@ -17791,6 +17832,7 @@ START_TEST(msg)
test_notify_message
();
test_SetActiveWindow
();
test_restore_messages
();
test_invalid_window
();
if
(
!
pTrackMouseEvent
)
win_skip
(
"TrackMouseEvent is not available
\n
"
);
...
...
server/queue.c
View file @
f5f633e7
...
...
@@ -2394,6 +2394,12 @@ DECL_HANDLER(get_message)
reply
->
active_hooks
=
get_active_hooks
();
if
(
get_win
&&
get_win
!=
1
&&
get_win
!=
-
1
&&
!
get_user_object
(
get_win
,
USER_WINDOW
))
{
set_win32_error
(
ERROR_INVALID_WINDOW_HANDLE
);
return
;
}
if
(
!
queue
)
return
;
queue
->
last_get_msg
=
current_time
;
if
(
!
filter
)
filter
=
QS_ALLINPUT
;
...
...
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