From 7332de64a5a204cc285bdc1f8768d3217103b7dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 10 Feb 2020 17:48:30 +0100 Subject: [PATCH] server: Validate status in continue_debug_event. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/ntdll/tests/exception.c | 4 ++++ server/debugger.c | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index e8b481e703f..07e05e45c90 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -1000,6 +1000,10 @@ static void test_debugger(void) continuestatus = DBG_CONTINUE; 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) { trace("event %d not coming from main thread, ignoring\n", de.dwDebugEventCode); diff --git a/server/debugger.c b/server/debugger.c index a5c39aa33e7..5b06b73b4be 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -612,8 +612,16 @@ DECL_HANDLER(wait_debug_event) /* Continue a debug event */ DECL_HANDLER(continue_debug_event) { - struct process *process = get_process_from_id( req->pid ); - if (process) + struct process *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 ); if (thread)