From cee9a0f2a3f0cb9ad1221167397689f928b11dd6 Mon Sep 17 00:00:00 2001 From: Glenn Wurster Date: Thu, 25 Aug 2005 19:20:21 +0000 Subject: [PATCH] Make stack check work if stack is a small value. --- dlls/ntdll/signal_i386.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 4863227a885..6eb2429f6e2 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -761,7 +761,8 @@ static EXCEPTION_RECORD *setup_exception( SIGCONTEXT *sigcontext, raise_func fun 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;