submitted-nptl-invalid-td
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Mon, 25 Aug 2025 19:11:05 +0000 (21:11 +0200)
committerAurelien Jarno <aurel32@debian.org>
Mon, 25 Aug 2025 19:11:05 +0000 (21:11 +0200)
2010-02-27  Aurelien Jarno  <aurelien@aurel32.net>

* 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

index 39af275c254ef3e737736bd5c38099bada8746d6..ae0f9bf22d039f66a716db92509bc21ef8f55055 100644 (file)
@@ -242,8 +242,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__))