summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinan Zhang <zyn8950@gmail.com>2019-07-03 23:48:47 (GMT)
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2019-07-12 03:51:29 (GMT)
commit7720b6e3851d200449914448c7163f7af92cd63f (patch)
treef6e630912b0aa9c68b1fce40b32727537369917c
parent40a3435b8dc225ad61329aca89d9c8d0dfbc03ab (diff)
downloadjemalloc-7720b6e3851d200449914448c7163f7af92cd63f.zip
jemalloc-7720b6e3851d200449914448c7163f7af92cd63f.tar.gz
jemalloc-7720b6e3851d200449914448c7163f7af92cd63f.tar.bz2
Fix redzone setting and checking
-rw-r--r--include/jemalloc/internal/safety_check.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/jemalloc/internal/safety_check.h b/include/jemalloc/internal/safety_check.h
index 1b53fc4..53339ac 100644
--- a/include/jemalloc/internal/safety_check.h
+++ b/include/jemalloc/internal/safety_check.h
@@ -9,7 +9,7 @@ JEMALLOC_ALWAYS_INLINE void
safety_check_set_redzone(void *ptr, size_t usize, size_t bumped_usize) {
assert(usize < bumped_usize);
for (size_t i = usize; i < bumped_usize && i < usize + 32; ++i) {
- *((unsigned char *)ptr + usize) = 0xBC;
+ *((unsigned char *)ptr + i) = 0xBC;
}
}
@@ -17,7 +17,7 @@ JEMALLOC_ALWAYS_INLINE void
safety_check_verify_redzone(const void *ptr, size_t usize, size_t bumped_usize)
{
for (size_t i = usize; i < bumped_usize && i < usize + 32; ++i) {
- if (unlikely(*((unsigned char *)ptr + usize) != 0xBC)) {
+ if (unlikely(*((unsigned char *)ptr + i) != 0xBC)) {
safety_check_fail("Use after free error\n");
}
}