mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-08 14:20:07 +00:00
htl: Avoid crashing when passed invalid pthread_t values
This commit is contained in:
parent
bc487d7141
commit
1d62a40373
@ -173,12 +173,14 @@ extern int __pthread_concurrency;
|
||||
brain-dead users of the pthread interface incorrectly assume that 0
|
||||
is an invalid pthread id.) */
|
||||
extern struct __pthread **__pthread_threads;
|
||||
extern int __pthread_max_threads;
|
||||
extern pthread_rwlock_t __pthread_threads_lock;
|
||||
|
||||
#define __pthread_getid(thread) \
|
||||
({ struct __pthread *__t; \
|
||||
({ struct __pthread *__t = NULL; \
|
||||
__pthread_rwlock_rdlock (&__pthread_threads_lock); \
|
||||
__t = __pthread_threads[thread - 1]; \
|
||||
if (thread <= __pthread_max_threads) \
|
||||
__t = __pthread_threads[thread - 1]; \
|
||||
__pthread_rwlock_unlock (&__pthread_threads_lock); \
|
||||
__t; })
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user