Module: wine Branch: master Commit: ec418e7f55f5e38f8825187ae5dfe33fec31689b URL: https://source.winehq.org/git/wine.git/?a=commit;h=ec418e7f55f5e38f8825187ae...
Author: Johannes Brandstätter jbrandst@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@2ds.eu Signed-off-by: Alexandre Julliard julliard@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;