Module: wine Branch: master Commit: d85ba603713f54b10ea723c7300c9567f3195d89 URL: https://gitlab.winehq.org/wine/wine/-/commit/d85ba603713f54b10ea723c7300c956...
Author: Alexandre Julliard julliard@winehq.org Date: Fri May 31 16:33:13 2024 +0200
msvcrt: Don't use rva_to_ptr() for non-RVA values.
---
dlls/msvcrt/except_x86_64.c | 8 ++++---- dlls/msvcrt/handler4.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/msvcrt/except_x86_64.c b/dlls/msvcrt/except_x86_64.c index b0cf2ff9425..13bb0fa6fbd 100644 --- a/dlls/msvcrt/except_x86_64.c +++ b/dlls/msvcrt/except_x86_64.c @@ -78,7 +78,7 @@ static void cxx_local_unwind(ULONG64 frame, DISPATCHER_CONTEXT *dispatch, { const unwind_info *unwind_table = rva_to_ptr(descr->unwind_table, dispatch->ImageBase); void (__cdecl *handler)(ULONG64 unk, ULONG64 rbp); - int *unwind_help = rva_to_ptr(descr->unwind_help, frame); + int *unwind_help = (int *)(frame + descr->unwind_help); int trylevel;
if (unwind_help[0] == -2) @@ -137,7 +137,7 @@ static void* WINAPI call_catch_block(EXCEPTION_RECORD *rec) EXCEPTION_RECORD *untrans_rec = (void*)rec->ExceptionInformation[6]; CONTEXT *context = (void*)rec->ExceptionInformation[7]; void* (__cdecl *handler)(ULONG64 unk, ULONG64 rbp) = (void*)rec->ExceptionInformation[5]; - int *unwind_help = rva_to_ptr(descr->unwind_help, frame); + int *unwind_help = (int *)(frame + descr->unwind_help); EXCEPTION_POINTERS ep = { prev_rec, context }; cxx_catch_ctx ctx; void *ret_addr = NULL; @@ -214,7 +214,7 @@ static inline void find_catch_block(EXCEPTION_RECORD *rec, CONTEXT *context, if (!i) in_catch = NULL;
- unwind_help = rva_to_ptr(descr->unwind_help, orig_frame); + unwind_help = (int *)(orig_frame + descr->unwind_help); if (trylevel > unwind_help[1]) unwind_help[0] = unwind_help[1] = trylevel; else @@ -336,7 +336,7 @@ static DWORD cxx_frame_handler(EXCEPTION_RECORD *rec, ULONG64 frame, { TRACE("nested exception detected\n"); unwindlevel = tryblock->end_level; - orig_frame = *(ULONG64*)rva_to_ptr(catchblock->frame, frame); + orig_frame = *(ULONG64*)(frame + catchblock->frame); TRACE("setting orig_frame to %I64x\n", orig_frame); } } diff --git a/dlls/msvcrt/handler4.c b/dlls/msvcrt/handler4.c index 878a5497aaa..0f54ddd9f1f 100644 --- a/dlls/msvcrt/handler4.c +++ b/dlls/msvcrt/handler4.c @@ -375,7 +375,7 @@ static void cxx_local_unwind4(ULONG64 frame, DISPATCHER_CONTEXT *dispatch, if (ui.handler) { handler_dtor = rva_to_ptr(ui.handler, dispatch->ImageBase); - obj = rva_to_ptr(ui.object, frame); + obj = (void *)(frame + ui.object); if(ui.type == UNWIND_TYPE_DTOR_PTR) obj = *(void**)obj; TRACE("handler: %p object: %p\n", handler_dtor, obj); @@ -619,7 +619,7 @@ static DWORD cxx_frame_handler4(EXCEPTION_RECORD *rec, ULONG64 frame, if (descr->header & FUNC_DESCR_IS_CATCH) { TRACE("nested exception detected\n"); - orig_frame = *(ULONG64*)rva_to_ptr(descr->frame, frame); + orig_frame = *(ULONG64 *)(frame + descr->frame); TRACE("setting orig_frame to %Ix\n", orig_frame); }