mirror of
https://github.com/reactos/reactos.git
synced 2026-05-28 03:44:02 +08:00
[PSEH] Fix a bug with try inside except
PSEH has 2 scopes: an outer scope, that starts with _SEH3_TRY and ends with _SEH3_END, and an inner scope that goes around the try block only. PSEH tracks try-levels by using an enum, which increments at every new TRY scrope, and which needs to be accessible in the outer scope for all registration and cleanup to work. But it should only increment when nested within the inner try scope, not from the except scope. This is fixed by adding an additional _SEH3$_InnerTryLevel, which increments only within the try block, but resets to the parent-value outside of it. Should fix CORE-20316.
This commit is contained in:
@@ -112,6 +112,7 @@ void _SEH3$_UnregisterTryLevel(
|
||||
enum
|
||||
{
|
||||
_SEH3$_TryLevel = -1,
|
||||
_SEH3$_InnerTryLevel = -1,
|
||||
};
|
||||
|
||||
#ifndef __clang__
|
||||
@@ -375,7 +376,7 @@ _Pragma("GCC diagnostic pop") \
|
||||
\
|
||||
/* Count the try level. Outside of any __try, _SEH3$_TryLevel is -1 */ \
|
||||
enum { \
|
||||
_SEH3$_PreviousTryLevel = _SEH3$_TryLevel, \
|
||||
_SEH3$_PreviousTryLevel = _SEH3$_InnerTryLevel, \
|
||||
_SEH3$_TryLevel = _SEH3$_PreviousTryLevel + 1, \
|
||||
}; \
|
||||
\
|
||||
@@ -388,6 +389,11 @@ _Pragma("GCC diagnostic pop") \
|
||||
goto _SEH3$_l_BeforeTry; \
|
||||
{ \
|
||||
__label__ _SEH3$_l_Leave; \
|
||||
\
|
||||
enum { \
|
||||
_SEH3$_InnerTryLevel = _SEH3$_TryLevel, \
|
||||
}; \
|
||||
\
|
||||
_SEH3$_l_Leave: (void)0; \
|
||||
/* Silence warning */ goto _SEH3$_l_AfterTry; \
|
||||
/* Silence warning */ goto _SEH3$_l_Leave; \
|
||||
|
||||
Reference in New Issue
Block a user