ntdll: Avoid crashing in check_atl_thunk if an execution exception was raised with a bad address.

This commit is contained in:
Robert Shearman 2006-09-27 15:51:07 +01:00 committed by Alexandre Julliard
parent c88bbd8092
commit 5881d91cfc
1 changed files with 19 additions and 7 deletions

View File

@ -828,14 +828,26 @@ struct atl_thunk
*/
static BOOL check_atl_thunk( EXCEPTION_RECORD *rec, CONTEXT *context )
{
struct atl_thunk *thunk = (struct atl_thunk *)rec->ExceptionInformation[1];
const struct atl_thunk *thunk = (const struct atl_thunk *)rec->ExceptionInformation[1];
BOOL ret = FALSE;
if (thunk->movl != 0x042444c7 || thunk->jmp != 0xe9) return FALSE;
*((DWORD *)context->Esp + 1) = thunk->this;
context->Eip = (DWORD_PTR)(&thunk->func + 1) + thunk->func;
TRACE( "emulating ATL thunk at %p, func=%08lx arg=%08lx\n",
thunk, context->Eip, *((DWORD *)context->Esp + 1) );
return TRUE;
__TRY
{
if (thunk->movl == 0x042444c7 && thunk->jmp == 0xe9)
{
*((DWORD *)context->Esp + 1) = thunk->this;
context->Eip = (DWORD_PTR)(&thunk->func + 1) + thunk->func;
TRACE( "emulating ATL thunk at %p, func=%08lx arg=%08lx\n",
thunk, context->Eip, *((DWORD *)context->Esp + 1) );
ret = TRUE;
}
}
__EXCEPT_PAGE_FAULT
{
return FALSE;
}
__ENDTRY
return ret;
}