summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Heap/HeapBlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibJS/Heap/HeapBlock.h')
-rw-r--r--Libraries/LibJS/Heap/HeapBlock.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Libraries/LibJS/Heap/HeapBlock.h b/Libraries/LibJS/Heap/HeapBlock.h
index 6269ebd45d..3de49c5e28 100644
--- a/Libraries/LibJS/Heap/HeapBlock.h
+++ b/Libraries/LibJS/Heap/HeapBlock.h
@@ -64,6 +64,8 @@ public:
if (pointer < reinterpret_cast<FlatPtr>(m_storage))
return nullptr;
size_t cell_index = (pointer - reinterpret_cast<FlatPtr>(m_storage)) / m_cell_size;
+ if (cell_index >= cell_count())
+ return nullptr;
return cell(cell_index);
}