diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2015-10-08 18:02:43 +0000 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2015-10-08 18:02:43 +0000 |
commit | 4bffffcaeb99e72e82b4d208701249dee3a8a9ea (patch) | |
tree | 6cf469cf897f9172a3cd1993e2db80ca451205b0 | |
parent | b7538bbddc985f0846b6bff2d0c70f59648ef914 (diff) | |
download | FreeBSD-src-4bffffcaeb99e72e82b4d208701249dee3a8a9ea.zip FreeBSD-src-4bffffcaeb99e72e82b4d208701249dee3a8a9ea.tar.gz |
MFC r288238:
MFV c3ccd112: Correct off-by-ones in free_exception of emergency buffer
-rw-r--r-- | contrib/libcxxrt/exception.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc index e428773..c559f97 100644 --- a/contrib/libcxxrt/exception.cc +++ b/contrib/libcxxrt/exception.cc @@ -516,7 +516,7 @@ static void emergency_malloc_free(char *ptr) 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); |