libthr: check for possible overflow in the pthread_barrier_init() count.
Following up on r320900, where the check for negative count values was removed, add a check to prevent integer overflow. This is to account that b_count, b_waiters but most importantly the total number of threads in the system are signed values. Discussed with: kib MFC after: 2 weeks
This commit is contained in:
parent
0a84d3e5f0
commit
1c9158aabe
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=321011
@ -100,7 +100,7 @@ _pthread_barrier_init(pthread_barrier_t *barrier,
|
||||
pthread_barrier_t bar;
|
||||
int pshared;
|
||||
|
||||
if (barrier == NULL || count == 0)
|
||||
if (barrier == NULL || count == 0 || count > INT_MAX)
|
||||
return (EINVAL);
|
||||
|
||||
if (attr == NULL || *attr == NULL ||
|
||||
|
Loading…
Reference in New Issue
Block a user