svn commit: r321832 - stable/11/lib/libthr/thread

Pedro F. Giffuni pfg at FreeBSD.org
Tue Aug 1 01:23:56 UTC 2017


Author: pfg
Date: Tue Aug  1 01:23:55 2017
New Revision: 321832
URL: https://svnweb.freebsd.org/changeset/base/321832

Log:
  MFC r320990, r321011:
  
  libthr: Avoid checking for negative values in usigned count.
  
  Check for overflow instead.

Modified:
  stable/11/lib/libthr/thread/thr_barrier.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libthr/thread/thr_barrier.c
==============================================================================
--- stable/11/lib/libthr/thread/thr_barrier.c	Mon Jul 31 23:04:12 2017	(r321831)
+++ stable/11/lib/libthr/thread/thr_barrier.c	Tue Aug  1 01:23:55 2017	(r321832)
@@ -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 ||


More information about the svn-src-stable mailing list