mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
AK: Avoid OOB access in UniformBumpAllocator::destroy_all()
Otherwise we would end up calling T::~T() on some random memory right after our mapped block, which is most likely a pretty bad thing to do :P
This commit is contained in:
parent
0e5e6f2e08
commit
0f1425c895
Notes:
sideshowbarker
2024-07-18 07:03:15 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/0f1425c895a
@ -163,7 +163,7 @@ public:
|
||||
{
|
||||
this->for_each_chunk([&](auto chunk) {
|
||||
auto base_ptr = align_up_to(chunk + sizeof(typename Allocator::ChunkHeader), alignof(T));
|
||||
FlatPtr end_offset = this->m_chunk_size;
|
||||
FlatPtr end_offset = this->m_chunk_size - sizeof(typename Allocator::ChunkHeader);
|
||||
if (chunk == this->m_current_chunk)
|
||||
end_offset = this->m_byte_offset_into_current_chunk;
|
||||
for (; base_ptr - chunk < end_offset; base_ptr += sizeof(T))
|
||||
|
Loading…
Reference in New Issue
Block a user