Explorar el Código

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.
Andreas Kling hace 3 años
padre
commit
ca940d7240
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      Userland/Libraries/LibJS/Heap/HeapBlock.cpp

+ 1 - 1
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)