[PATCH] ntdll: Only call wine exception handlers on the current stack.

Rémi Bernon rbernon at codeweavers.com
Mon Jan 31 09:24:16 CST 2022


MK11 creates an alternate stack and sometimes throws an exception which
gets incorrectly handled by a Wine exception handler, causing the game
to crash.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/ntdll/signal_x86_64.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 7e77329363c..36985832e4a 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -463,7 +463,9 @@ static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_contex
             }
         }
         /* hack: call wine handlers registered in the tib list */
-        else while ((ULONG64)teb_frame < context.Rsp)
+        else while ((ULONG64)teb_frame < context.Rsp &&
+                    (ULONG64)teb_frame >= (ULONG64)NtCurrentTeb()->Tib.StackLimit &&
+                    (ULONG64)teb_frame <= (ULONG64)NtCurrentTeb()->Tib.StackBase)
         {
             TRACE_(seh)( "found wine frame %p rsp %p handler %p\n",
                          teb_frame, (void *)context.Rsp, teb_frame->Handler );
-- 
2.34.1




More information about the wine-devel mailing list