Fix 'address of fudged_set is used out of scope' code defect (sigmask)
authorIvan Maidanski <ivmai@mail.ru>
Fri, 28 Oct 2016 07:07:43 +0000 (10:07 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 28 Oct 2016 07:07:43 +0000 (10:07 +0300)
(fix commit 81d04a6)

* pthread_support.c [!GC_NO_PTHREAD_SIGMASK] (pthread_sigmask): Move
fudged_set to the outer scope where REAL_FUNC(pthread_sigmask) is
called (a pointer to fudged_set could be passed to the latter function).

pthread_support.c

index 1b6a302..86e6c44 100644 (file)
@@ -1243,11 +1243,13 @@ GC_INNER void GC_init_parallel(void)
   GC_API int WRAP_FUNC(pthread_sigmask)(int how, const sigset_t *set,
                                         sigset_t *oset)
   {
+    sigset_t fudged_set;
+
     INIT_REAL_SYMS();
     if (set != NULL && (how == SIG_BLOCK || how == SIG_SETMASK)) {
-        sigset_t fudged_set = *set;
         int sig_suspend = GC_get_suspend_signal();
 
+        fudged_set = *set;
         GC_ASSERT(sig_suspend >= 0);
         if (sigdelset(&fudged_set, sig_suspend) != 0)
             ABORT("sigdelset failed");