]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Have VG_(is_in_syscall) return False if no syscall was done yet.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 10 Sep 2019 20:47:58 +0000 (22:47 +0200)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 10 Sep 2019 20:47:58 +0000 (22:47 +0200)
As when no syscall was done yet, the syscallInfo pointer is still null,
we return False if this is null, rather than SEGV due to null ptr.

This can at least happen when reporting the scheduler status before
the first syscall was done.

coregrind/m_syswrap/syswrap-main.c

index a06234e43143531287d979eb01f0cf295feeba8e..868645e4bca202332ae93d2aa78b264a93d4c268 100644 (file)
@@ -1694,7 +1694,7 @@ void VG_(clear_syscallInfo) ( ThreadId tid )
 Bool VG_(is_in_syscall) ( ThreadId tid )
 {
    vg_assert(tid >= 0 && tid < VG_N_THREADS);
-   return (syscallInfo[tid].status.what != SsIdle);
+   return (syscallInfo && syscallInfo[tid].status.what != SsIdle);
 }
 
 Word VG_(is_in_syscall_no) (ThreadId tid )