1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

Kernel: Make Region weakable and use WeakPtr<Region> instead of Region*

This turns use-after-free bugs into null pointer dereferences instead.
This commit is contained in:
Andreas Kling 2020-02-24 13:24:30 +01:00
parent 79576f9280
commit 30a8991dbf
5 changed files with 14 additions and 8 deletions

View file

@ -273,7 +273,7 @@ Region* Process::region_from_range(const Range& range)
for (auto& region : m_regions) {
if (region.vaddr() == range.base() && region.size() == size) {
m_region_lookup_cache.range = range;
m_region_lookup_cache.region = &region;
m_region_lookup_cache.region = region.make_weak_ptr();
return &region;
}
}