[ntdll] Wrap on overflow check in signal handler - Take 2

Glenn Wurster gwurster at scs.carleton.ca
Mon Aug 22 12:34:11 CDT 2005


Ignore the previous patch, it was bad.

Changelog:
  Make stack check work if stack is a small value

Glenn.

Index: dlls/ntdll/signal_i386.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/signal_i386.c,v
retrieving revision 1.96
diff -u -r1.96 signal_i386.c
--- dlls/ntdll/signal_i386.c	3 Jul 2005 11:24:54 -0000	1.96
+++ dlls/ntdll/signal_i386.c	22 Aug 2005 17:29:45 -0000
@@ -761,7 +761,8 @@
         server_abort_thread(1);
     }
 
-    if ((char *)(stack - 1) < (char *)NtCurrentTeb()->Tib.StackLimit + 4096 ||
+    if (stack - 1 > stack || /* Check for overflow in subtraction */
+        (char *)(stack - 1) < (char *)NtCurrentTeb()->Tib.StackLimit + 4096 ||
         (char *)stack > (char *)NtCurrentTeb()->Tib.StackBase)
     {
         UINT diff = (char *)NtCurrentTeb()->Tib.StackLimit + 4096 - (char *)stack;



More information about the wine-patches mailing list