Date: Sat, 15 Jul 2017 15:00:13 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321011 - head/lib/libthr/thread Message-ID: <201707151500.v6FF0DWG000470@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Sat Jul 15 15:00:13 2017 New Revision: 321011 URL: https://svnweb.freebsd.org/changeset/base/321011 Log: 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 Modified: head/lib/libthr/thread/thr_barrier.c Modified: head/lib/libthr/thread/thr_barrier.c ============================================================================== --- head/lib/libthr/thread/thr_barrier.c Sat Jul 15 14:57:24 2017 (r321010) +++ head/lib/libthr/thread/thr_barrier.c Sat Jul 15 15:00:13 2017 (r321011) @@ -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 ||
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707151500.v6FF0DWG000470>