Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Aug 2017 01:25:18 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r321833 - stable/10/lib/libthr/thread
Message-ID:  <201708010125.v711PIUP046795@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Tue Aug  1 01:25:18 2017
New Revision: 321833
URL: https://svnweb.freebsd.org/changeset/base/321833

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

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

Modified: stable/10/lib/libthr/thread/thr_barrier.c
==============================================================================
--- stable/10/lib/libthr/thread/thr_barrier.c	Tue Aug  1 01:23:55 2017	(r321832)
+++ stable/10/lib/libthr/thread/thr_barrier.c	Tue Aug  1 01:25:18 2017	(r321833)
@@ -83,7 +83,7 @@ _pthread_barrier_init(pthread_barrier_t *barrier,
 
 	(void)attr;
 
-	if (barrier == NULL || count <= 0)
+	if (barrier == NULL || count == 0 || count > INT_MAX)
 		return (EINVAL);
 
 	bar = calloc(1, sizeof(struct pthread_barrier));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708010125.v711PIUP046795>