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
Родитель 40b5f2b85d
Коммит 1aa05fddd8
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -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);