Module: wine Branch: master Commit: 5881d91cfc20f830893e00b1220299de303ee225 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=5881d91cfc20f830893e00b1...
Author: Robert Shearman rob@codeweavers.com Date: Wed Sep 27 15:51:07 2006 +0100
ntdll: Avoid crashing in check_atl_thunk if an execution exception was raised with a bad address.
---
dlls/ntdll/signal_i386.c | 26 +++++++++++++++++++------- 1 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 44f47ec..9a8f197 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -828,14 +828,26 @@ #include "poppack.h" */ 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; }