submitted-nptl-invalid-td
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Sat, 17 May 2025 15:15:43 +0000 (17:15 +0200)
committerAurelien Jarno <aurel32@debian.org>
Sat, 17 May 2025 15:15:43 +0000 (17:15 +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 2d620ed20d57ad29896e14a70f091f6b7bcdab80..8a1679b55c139c33362dfb8d6fc50f4e83a4deee 100644 (file)
@@ -232,8 +232,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__))