From 9f309b32e65c3d6a6023c3185b37a52b1de4a7e7 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Thu, 8 Feb 2007 21:33:33 +0100 Subject: [PATCH] msvcrt: Reset a signal to DFL before it's used. --- dlls/msvcrt/except.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/dlls/msvcrt/except.c b/dlls/msvcrt/except.c index fd79926c8d6..1ee13da5e2c 100644 --- a/dlls/msvcrt/except.c +++ b/dlls/msvcrt/except.c @@ -429,6 +429,7 @@ static const struct static LONG WINAPI msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except) { LONG ret = EXCEPTION_CONTINUE_SEARCH; + MSVCRT___sighandler_t handler; if (!except || !except->ExceptionRecord) return EXCEPTION_CONTINUE_SEARCH; @@ -436,10 +437,13 @@ static LONG WINAPI msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except) switch (except->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: - if (sighandlers[MSVCRT_SIGSEGV]) + if ((handler = sighandlers[MSVCRT_SIGSEGV]) != MSVCRT_SIG_DFL) { - if (sighandlers[MSVCRT_SIGSEGV] != MSVCRT_SIG_IGN) - sighandlers[MSVCRT_SIGSEGV](MSVCRT_SIGSEGV); + if (handler != MSVCRT_SIG_IGN) + { + sighandlers[MSVCRT_SIGSEGV] = MSVCRT_SIG_DFL; + handler(MSVCRT_SIGSEGV); + } ret = EXCEPTION_CONTINUE_EXECUTION; } break; @@ -455,31 +459,36 @@ static LONG WINAPI msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except) case EXCEPTION_FLT_OVERFLOW: case EXCEPTION_FLT_STACK_CHECK: case EXCEPTION_FLT_UNDERFLOW: - if (sighandlers[MSVCRT_SIGFPE]) + if ((handler = sighandlers[MSVCRT_SIGFPE]) != MSVCRT_SIG_DFL) { - if (sighandlers[MSVCRT_SIGFPE] != MSVCRT_SIG_IGN) + if (handler != MSVCRT_SIG_IGN) { int i, float_signal = _FPE_INVALID; - float_handler handler = (float_handler)sighandlers[MSVCRT_SIGFPE]; + sighandlers[MSVCRT_SIGFPE] = MSVCRT_SIG_DFL; for (i = 0; i < sizeof(float_exception_map) / - sizeof(float_exception_map[0]); i++) + sizeof(float_exception_map[0]); i++) + { if (float_exception_map[i].status == - except->ExceptionRecord->ExceptionCode) + except->ExceptionRecord->ExceptionCode) { float_signal = float_exception_map[i].signal; break; } - handler(MSVCRT_SIGFPE, float_signal); + } + ((float_handler)handler)(MSVCRT_SIGFPE, float_signal); } ret = EXCEPTION_CONTINUE_EXECUTION; } break; case EXCEPTION_ILLEGAL_INSTRUCTION: - if (sighandlers[MSVCRT_SIGILL]) + if ((handler = sighandlers[MSVCRT_SIGILL]) != MSVCRT_SIG_DFL) { - if (sighandlers[MSVCRT_SIGILL] != MSVCRT_SIG_IGN) - sighandlers[MSVCRT_SIGILL](MSVCRT_SIGILL); + if (handler != MSVCRT_SIG_IGN) + { + sighandlers[MSVCRT_SIGILL] = MSVCRT_SIG_DFL; + handler(MSVCRT_SIGILL); + } ret = EXCEPTION_CONTINUE_EXECUTION; } break; -- 2.11.4.GIT