From ca940d72402f5edcb089d64502811ed8cb64c2bc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 11 Sep 2021 16:58:23 +0200 Subject: [PATCH] LibJS: Fix ASAN poisoning range in new HeapBlocks When poisoning HeapBlock::m_storage, we have to compute the storage size by excluding the HeapBlock header. --- Userland/Libraries/LibJS/Heap/HeapBlock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Heap/HeapBlock.cpp b/Userland/Libraries/LibJS/Heap/HeapBlock.cpp index 000cac593d..fd997857d2 100644 --- a/Userland/Libraries/LibJS/Heap/HeapBlock.cpp +++ b/Userland/Libraries/LibJS/Heap/HeapBlock.cpp @@ -36,7 +36,7 @@ HeapBlock::HeapBlock(Heap& heap, size_t cell_size) , m_cell_size(cell_size) { VERIFY(cell_size >= sizeof(FreelistEntry)); - ASAN_POISON_MEMORY_REGION(m_storage, block_size); + ASAN_POISON_MEMORY_REGION(m_storage, block_size - sizeof(HeapBlock)); } void HeapBlock::deallocate(Cell* cell)