Piotr Caban : msvcrt: Terminate on noexcept function trying to propagate exception (i386).
Alexandre Julliard
julliard at winehq.org
Mon Oct 5 15:54:56 CDT 2020
Module: wine
Branch: master
Commit: 26c1f8fb07790f51c0fbe0012144e213edccd8ed
URL: https://source.winehq.org/git/wine.git/?a=commit;h=26c1f8fb07790f51c0fbe0012144e213edccd8ed
Author: Piotr Caban <piotr at codeweavers.com>
Date: Fri Oct 2 22:27:16 2020 +0200
msvcrt: Terminate on noexcept function trying to propagate exception (i386).
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/cppexcept.h | 1 +
dlls/msvcrt/except_i386.c | 19 ++++++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcrt/cppexcept.h b/dlls/msvcrt/cppexcept.h
index 69fb3c5eed..7efb099cca 100644
--- a/dlls/msvcrt/cppexcept.h
+++ b/dlls/msvcrt/cppexcept.h
@@ -29,6 +29,7 @@
#define CXX_EXCEPTION 0xe06d7363
#define FUNC_DESCR_SYNCHRONOUS 1 /* synchronous exceptions only (built with /EHs and /EHsc) */
+#define FUNC_DESCR_NOEXCEPT 4 /* noexcept function */
typedef void (*vtable_ptr)(void);
diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c
index ea5634aefb..45054d885c 100644
--- a/dlls/msvcrt/except_i386.c
+++ b/dlls/msvcrt/except_i386.c
@@ -551,6 +551,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();
+ }
+}
+
/*********************************************************************
* cxx_frame_handler
*
@@ -578,7 +590,11 @@ DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame
if (descr->unwind_count && !nested_frame) cxx_local_unwind( frame, descr, -1 );
return ExceptionContinueSearch;
}
- if (!descr->tryblock_count) return ExceptionContinueSearch;
+ if (!descr->tryblock_count)
+ {
+ check_noexcept(rec, descr, nested_frame != NULL);
+ return ExceptionContinueSearch;
+ }
if(rec->ExceptionCode == CXX_EXCEPTION &&
rec->ExceptionInformation[1] == 0 && rec->ExceptionInformation[2] == 0)
@@ -643,6 +659,7 @@ DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame
call_catch_block( rec, context, frame, descr,
nested_frame, exc_type );
+ check_noexcept(rec, descr, nested_frame != NULL);
return ExceptionContinueSearch;
}
More information about the wine-cvs
mailing list