Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Sep 2015 22:29:21 +0000 (UTC)
From:      "Conrad E. Meyer" <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288238 - head/contrib/libcxxrt
Message-ID:  <201509252229.t8PMTLYH082612@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Fri Sep 25 22:29:21 2015
New Revision: 288238
URL: https://svnweb.freebsd.org/changeset/base/288238

Log:
  MFV c3ccd112: Correct off-by-ones in free_exception of emergency buffer
  
  Note, this has been broken since import in r227825.
  
  PR:		https://github.com/pathscale/libcxxrt/issues/29
  Reviewed by:	emaste (earlier version), kan (informally)
  Obtained from:	Anton Rang
  Relnotes:	yes
  Sponsored by:	EMC / Isilon Storage Division
  Differential Revision:	https://reviews.freebsd.org/D3733

Modified:
  head/contrib/libcxxrt/exception.cc

Modified: head/contrib/libcxxrt/exception.cc
==============================================================================
--- head/contrib/libcxxrt/exception.cc	Fri Sep 25 22:19:35 2015	(r288237)
+++ head/contrib/libcxxrt/exception.cc	Fri Sep 25 22:29:21 2015	(r288238)
@@ -516,7 +516,7 @@ static void emergency_malloc_free(char *
 			break;
 		}
 	}
-	assert(buffer > 0 &&
+	assert(buffer >= 0 &&
 	       "Trying to free something that is not an emergency buffer!");
 	// emergency_malloc() is expected to return 0-initialized data.  We don't
 	// zero the buffer when allocating it, because the static buffers will
@@ -556,7 +556,7 @@ static void free_exception(char *e)
 {
 	// If this allocation is within the address range of the emergency buffer,
 	// don't call free() because it was not allocated with malloc()
-	if ((e > emergency_buffer) &&
+	if ((e >= emergency_buffer) &&
 	    (e < (emergency_buffer + sizeof(emergency_buffer))))
 	{
 		emergency_malloc_free(e);



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