msvcrt: Fix crash when rethrowing after a non-C++ exception on x86_64.
This fixes a crash seen with the .NET Framework 3.5 SP1 installer in a 64-bit prefix where ServiceModelReg.exe
throws a C++ exception, it's rethrown again, then a CLR exception (0xe0434f4d
) exception is thrown, and finally there's another C++ rethrow.
At the last rethrow, cxx_frame_handler()
detects the rethrow and sets *rec
to the previous exception record, which is the CLR exception, not the C++ exception. If +seh
is enabled, it then assumes *rec
is a C++ exception and tries to TRACE info about it, which crashes.
Move the rethrow detection before the exception type check, so the TRACEs are not done.