From e8c9b37fc2241af50359ffddc3d9967a88c6ede9 Mon Sep 17 00:00:00 2001 From: GNU Libc Maintainers Date: Sun, 28 Jan 2024 23:58:14 +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 --- nptl/pthreadP.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index 7e0ab8ef4..4ef109ac6 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -251,8 +251,8 @@ extern int __pthread_debug attribute_hidden; /* Simplified test. 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) #endif -- 2.30.2