From 1aa05fddd81846bfa2833dff5e0aaccc1e707c81 Mon Sep 17 00:00:00 2001 From: "Urabe, Shyouhei" Date: Wed, 24 Apr 2019 16:47:09 +0900 Subject: 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. --- transient_heap.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'transient_heap.c') 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); -- cgit v1.2.3