Skip to content
Snippets Groups Projects
Commit e4831f08 authored by Bernhard Übelacker's avatar Bernhard Übelacker Committed by Joel Holdsworth
Browse files

ntdll: Ignore pointers outside of the current stack in exception handlers.

https://bugs.winehq.org/show_bug.cgi?id=52159

01f0:err:virtual:virtual_setup_exception stack overflow 2896 bytes addr 0x1700563a3 stack 0x672004b0 (0x67200000-0x67201000-0x67e00000)
parent da6e0259
Branches
No related tags found
No related merge requests found
......@@ -502,7 +502,7 @@ 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)NtCurrentTeb()->Tib.StackLimit < (ULONG64)teb_frame && (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 );
......@@ -1333,7 +1333,7 @@ void CDECL RtlRestoreContext( CONTEXT *context, EXCEPTION_RECORD *rec )
}
/* hack: remove no longer accessible TEB frames */
while ((ULONG64)teb_frame < context->Rsp)
while ((ULONG64)teb_frame < context->Rsp && (ULONG64)NtCurrentTeb()->Tib.StackLimit < (ULONG64)teb_frame && (ULONG64)teb_frame < (ULONG64)NtCurrentTeb()->Tib.StackBase)
{
TRACE_(seh)( "removing TEB frame: %p\n", teb_frame );
teb_frame = __wine_pop_frame( teb_frame );
......@@ -1436,7 +1436,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
else /* hack: call builtin handlers registered in the tib list */
{
DWORD64 backup_frame = dispatch.EstablisherFrame;
while ((ULONG64)teb_frame < new_context.Rsp && (ULONG64)teb_frame < (ULONG64)end_frame)
while ((ULONG64)teb_frame < new_context.Rsp && (ULONG64)teb_frame < (ULONG64)end_frame && (ULONG64)NtCurrentTeb()->Tib.StackLimit < (ULONG64)teb_frame && (ULONG64)teb_frame < (ULONG64)NtCurrentTeb()->Tib.StackBase)
{
TRACE( "found builtin frame %p handler %p\n", teb_frame, teb_frame->Handler );
dispatch.EstablisherFrame = (ULONG64)teb_frame;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment