server: Validate status in continue_debug_event.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2020-02-10 17:48:30 +01:00 committed by Alexandre Julliard
parent d604fdbdd1
commit 7332de64a5
2 changed files with 14 additions and 2 deletions

View File

@ -1000,6 +1000,10 @@ static void test_debugger(void)
continuestatus = DBG_CONTINUE; continuestatus = DBG_CONTINUE;
ok(WaitForDebugEvent(&de, INFINITE), "reading debug event\n"); ok(WaitForDebugEvent(&de, INFINITE), "reading debug event\n");
ret = ContinueDebugEvent(de.dwProcessId, de.dwThreadId, 0xdeadbeef);
ok(!ret, "ContinueDebugEvent unexpectedly succeeded\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected last error: %u\n", GetLastError());
if (de.dwThreadId != pi.dwThreadId) if (de.dwThreadId != pi.dwThreadId)
{ {
trace("event %d not coming from main thread, ignoring\n", de.dwDebugEventCode); trace("event %d not coming from main thread, ignoring\n", de.dwDebugEventCode);

View File

@ -612,8 +612,16 @@ DECL_HANDLER(wait_debug_event)
/* Continue a debug event */ /* Continue a debug event */
DECL_HANDLER(continue_debug_event) DECL_HANDLER(continue_debug_event)
{ {
struct process *process = get_process_from_id( req->pid ); struct process *process;
if (process)
if (req->status != DBG_EXCEPTION_NOT_HANDLED &&
req->status != DBG_CONTINUE)
{
set_error( STATUS_INVALID_PARAMETER );
return;
}
if ((process = get_process_from_id( req->pid )))
{ {
struct thread *thread = get_thread_from_id( req->tid ); struct thread *thread = get_thread_from_id( req->tid );
if (thread) if (thread)