Make stack check work if stack is a small value.

This commit is contained in:
Glenn Wurster 2005-08-25 19:20:21 +00:00 committed by Alexandre Julliard
parent f1853ba186
commit cee9a0f2a3

View file

@ -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;