]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix uninitialized `err' in handle_extension()
authorAndreas Arnez <arnez@linux.ibm.com>
Wed, 15 May 2024 12:32:42 +0000 (14:32 +0200)
committerAndreas Arnez <arnez@linux.ibm.com>
Wed, 15 May 2024 12:32:42 +0000 (14:32 +0200)
In handle_extension(), in the case of a second return from SCHEDSETJMP the
variable `err' would be used uninitialized.  Fix this by avoiding any
access to `err' in this case.

coregrind/m_scheduler/scheduler.c

index fc8cf7c9cb1d421e3faaf568b37012e1154354d9..29751bb28283a79b3ab2845142d0342044a55f77 100644 (file)
@@ -1233,7 +1233,10 @@ static void handle_extension(ThreadId tid)
    SCHEDSETJMP(tid, jumped, err = VG_(client_extension)(tid));
    vg_assert(VG_(is_running_thread)(tid));
 
-   if (err != ExtErr_OK) {
+   if (jumped != (UWord)0) {
+      block_signals();
+      VG_(poll_signals)(tid);
+   } else if (err != ExtErr_OK) {
       ThreadState* tst = VG_(get_ThreadState)(tid);
       Addr addr = tst->arch.vex.guest_IP_AT_SYSCALL;
       switch (err) {
@@ -1244,11 +1247,6 @@ static void handle_extension(ThreadId tid)
          VG_(core_panic)("scheduler: bad return code from extension");
       }
    }
-
-   if (jumped != (UWord)0) {
-      block_signals();
-      VG_(poll_signals)(tid);
-   }
 }
 
 /* tid just requested a jump to the noredir version of its current