From: Philippe Waroquiers Date: Tue, 10 Sep 2019 20:47:58 +0000 (+0200) Subject: Have VG_(is_in_syscall) return False if no syscall was done yet. X-Git-Tag: VALGRIND_3_16_0~216 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53cceb2ac2c8f92e875b06c2017e707295e3e96b;p=thirdparty%2Fvalgrind.git Have VG_(is_in_syscall) return False if no syscall was done yet. 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. --- diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c index a06234e431..868645e4bc 100644 --- a/coregrind/m_syswrap/syswrap-main.c +++ b/coregrind/m_syswrap/syswrap-main.c @@ -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 )