Johannes Brandstätte =?UTF-8?Q?r=20?=: ntdll: Check for NULL context in NtGetContextThread.

Alexandre Julliard julliard at winehq.org
Thu Jul 12 17:45:39 CDT 2018


Module: wine
Branch: master
Commit: ec418e7f55f5e38f8825187ae5dfe33fec31689b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ec418e7f55f5e38f8825187ae5dfe33fec31689b

Author: Johannes Brandstätter <jbrandst at 2ds.eu>
Date:   Wed Jul 11 17:45:32 2018 +0200

ntdll: Check for NULL context in NtGetContextThread.

Crash Bandicoot N. Sane Trilogy calls NtGetContextThread
with the context being set to NULL which leads to a crash.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45428
Signed-off-by: Johannes Brandstätter <jbrandst at 2ds.eu>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/signal_x86_64.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 0d25360..e751082 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -2160,9 +2160,13 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
 NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
 {
     NTSTATUS ret;
-    DWORD needed_flags = context->ContextFlags;
+    DWORD needed_flags;
     BOOL self = (handle == GetCurrentThread());
 
+    if (!context) return STATUS_INVALID_PARAMETER;
+
+    needed_flags = context->ContextFlags;
+
     /* debug registers require a server call */
     if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_AMD64)) self = FALSE;
 




More information about the wine-cvs mailing list