diff options
author | cem <cem@FreeBSD.org> | 2015-09-25 22:29:21 +0000 |
---|---|---|
committer | cem <cem@FreeBSD.org> | 2015-09-25 22:29:21 +0000 |
commit | da49bf0a939c7750a83e43a357f53a7cccc8ca50 (patch) | |
tree | fd27a149b36d1918b32d7a2f79ee59280d7e1784 | |
parent | 4ae671bf65977cd18eeb7a3fbe99a40e9a5c46e9 (diff) | |
download | FreeBSD-src-da49bf0a939c7750a83e43a357f53a7cccc8ca50.zip FreeBSD-src-da49bf0a939c7750a83e43a357f53a7cccc8ca50.tar.gz |
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
-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); |