1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
Urabe, Shyouhei 2019-04-24 16:47:09 +09:00
parent 40b5f2b85d
commit 1aa05fddd8

View file

@ -780,6 +780,9 @@ clear_marked_index(struct transient_heap_block* block)
while (marked_index != TRANSIENT_HEAP_ALLOC_MARKING_LAST) { while (marked_index != TRANSIENT_HEAP_ALLOC_MARKING_LAST) {
struct transient_alloc_header *header = alloc_header(block, marked_index); 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); 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); if (0) fprintf(stderr, "clear_marked_index - block:%p mark_index:%d\n", (void *)block, marked_index);