File: submitted-nptl-invalid-td.patch

package info (click to toggle)
glibc 2.36-9%2Bdeb12u13
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-proposed-updates
  • size: 300,148 kB
  • sloc: ansic: 1,055,755; asm: 324,942; makefile: 15,198; python: 12,603; sh: 10,884; cpp: 5,685; awk: 1,883; perl: 518; yacc: 292; pascal: 182; sed: 39
file content (22 lines) | stat: -rw-r--r-- 891 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2010-02-27  Aurelien Jarno  <aurelien@aurel32.net>

	* pthreadP.h(INVALID_TD_P, INVALID_NOT_TERMINATED_TD_P): detect
	NULL pointers.

---
 sysdeps/nptl/pthreadP.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/sysdeps/nptl/pthreadP.h
+++ b/sysdeps/nptl/pthreadP.h
@@ -242,8 +242,8 @@
 /* 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__))