From 9b181deaed38ac5f955dde2bd9578f12301e1b93 Mon Sep 17 00:00:00 2001 From: GNU Libc Maintainers Date: Sun, 2 Oct 2022 18:46:25 +0100 Subject: [PATCH] submitted-nptl-invalid-td 2010-02-27 Aurelien Jarno * pthreadP.h(INVALID_TD_P, INVALID_NOT_TERMINATED_TD_P): detect NULL pointers. Gbp-Pq: Topic any Gbp-Pq: Name submitted-nptl-invalid-td.patch --- sysdeps/nptl/pthreadP.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/nptl/pthreadP.h b/sysdeps/nptl/pthreadP.h index 601db4ff2..e748b134d 100644 --- a/sysdeps/nptl/pthreadP.h +++ b/sysdeps/nptl/pthreadP.h @@ -241,8 +241,8 @@ libc_hidden_proto (__pthread_current_priority) /* This will not catch all invalid descriptors but is better than nothing. And if the test triggers the thread descriptor is guaranteed to be invalid. */ -#define INVALID_TD_P(pd) __builtin_expect ((pd)->tid <= 0, 0) -#define INVALID_NOT_TERMINATED_TD_P(pd) __builtin_expect ((pd)->tid < 0, 0) +#define INVALID_TD_P(pd) __builtin_expect (!pd || ((pd)->tid <= 0), 0) +#define INVALID_NOT_TERMINATED_TD_P(pd) __builtin_expect (!pd || ((pd)->tid < 0), 0) extern void __pthread_unwind (__pthread_unwind_buf_t *__buf) __cleanup_fct_attribute __attribute ((__noreturn__)) -- 2.30.2