[PATCH 3/5] vcruntime140_1: Don't terminate on state of -1.

Daniel Lehman dlehman25 at gmail.com
Tue Jun 2 20:56:15 CDT 2020


Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>
---

-1 is a valid state, but nothing to unwind

sample:
cl /EHa /Od /MD test.cpp

try {
    std::wstring value(L"");
    value = value.substr(std::wstring::npos, 1);
}
catch (std::exception)
{
    printf("catch\n");
}
---
 dlls/vcruntime140_1/except_x86_64.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dlls/vcruntime140_1/except_x86_64.c b/dlls/vcruntime140_1/except_x86_64.c
index b0c494ce1c..ef171a5f6c 100644
--- a/dlls/vcruntime140_1/except_x86_64.c
+++ b/dlls/vcruntime140_1/except_x86_64.c
@@ -416,6 +416,9 @@ static void cxx_local_unwind4(ULONG64 frame, DISPATCHER_CONTEXT *dispatch,
 
     TRACE("current level: %d, last level: %d\n", trylevel, last_level);
 
+    if (trylevel==-1)
+        return;
+
     if (trylevel<0 || trylevel>=descr->unwind_count)
     {
         ERR("invalid trylevel %d\n", trylevel);
-- 
2.17.1




More information about the wine-devel mailing list