aboutsummaryrefslogtreecommitdiffstats
path: root/transient_heap.c
diff options
context:
space:
mode:
authorUrabe, Shyouhei <shyouhei@ruby-lang.org>2019-04-24 16:47:09 +0900
committerUrabe, Shyouhei <shyouhei@ruby-lang.org>2019-04-26 15:59:40 +0900
commit1aa05fddd81846bfa2833dff5e0aaccc1e707c81 (patch)
tree9aa0e0f266eeb745fa91a5222684356d1374a9b4 /transient_heap.c
parent40b5f2b85dc5c50d7757c3b2522a767188b0e0b3 (diff)
downloadruby-1aa05fddd81846bfa2833dff5e0aaccc1e707c81.tar.gz
unpoison header before touching
This header is poisoned to detect unintentional buffer overrun. However in this (and forthcoming) function, we are intentionally looking at the header. We have to unpoison before anything.
Diffstat (limited to 'transient_heap.c')
-rw-r--r--transient_heap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/transient_heap.c b/transient_heap.c
index 1bc5094a09..bf2de155df 100644
--- a/transient_heap.c
+++ b/transient_heap.c
@@ -780,6 +780,9 @@ clear_marked_index(struct transient_heap_block* block)
while (marked_index != TRANSIENT_HEAP_ALLOC_MARKING_LAST) {
struct transient_alloc_header *header = alloc_header(block, marked_index);
+ /* header is poisoned to prevent buffer overflow, should
+ * unpoison first... */
+ unpoison_memory_region(header, sizeof *header, false);
TH_ASSERT(marked_index != TRANSIENT_HEAP_ALLOC_MARKING_FREE);
if (0) fprintf(stderr, "clear_marked_index - block:%p mark_index:%d\n", (void *)block, marked_index);