Module: wine Branch: master Commit: 8468a3ed77ba22d9a33b2251240e2a4e5462e1b7 URL: https://source.winehq.org/git/wine.git/?a=commit;h=8468a3ed77ba22d9a33b22512...
Author: Piotr Caban piotr@codeweavers.com Date: Fri Oct 2 22:27:20 2020 +0200
msvcrt: Terminate on noexcept function trying to propagate exception (x86_64).
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcrt/except_x86_64.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcrt/except_x86_64.c b/dlls/msvcrt/except_x86_64.c index 42283131e8..b7e77f7949 100644 --- a/dlls/msvcrt/except_x86_64.c +++ b/dlls/msvcrt/except_x86_64.c @@ -499,6 +499,18 @@ static LONG CALLBACK se_translation_filter(EXCEPTION_POINTERS *ep, void *c) return ExceptionContinueSearch; }
+static void check_noexcept( PEXCEPTION_RECORD rec, + const cxx_function_descr *descr, BOOL nested ) +{ + if (!nested && rec->ExceptionCode == CXX_EXCEPTION && + descr->magic >= CXX_FRAME_MAGIC_VC8 && + (descr->flags & FUNC_DESCR_NOEXCEPT)) + { + ERR("noexcept function propagating exception\n"); + MSVCRT_terminate(); + } +} + static DWORD cxx_frame_handler(EXCEPTION_RECORD *rec, ULONG64 frame, CONTEXT *context, DISPATCHER_CONTEXT *dispatch, const cxx_function_descr *descr) @@ -562,7 +574,11 @@ static DWORD cxx_frame_handler(EXCEPTION_RECORD *rec, ULONG64 frame, cxx_local_unwind(orig_frame, dispatch, descr, unwindlevel); return ExceptionContinueSearch; } - if (!descr->tryblock_count) return ExceptionContinueSearch; + if (!descr->tryblock_count) + { + check_noexcept(rec, descr, orig_frame != frame); + return ExceptionContinueSearch; + }
if (rec->ExceptionCode == CXX_EXCEPTION) { @@ -612,6 +628,7 @@ static DWORD cxx_frame_handler(EXCEPTION_RECORD *rec, ULONG64 frame, }
find_catch_block(rec, context, NULL, frame, dispatch, descr, exc_type, orig_frame); + check_noexcept(rec, descr, orig_frame != frame); return ExceptionContinueSearch; }