mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 21:57:18 +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:
parent
79576f9280
commit
30a8991dbf
Notes:
sideshowbarker
2024-07-19 09:05:16 +09:00
Author: https://github.com/awesomekling
Commit: 30a8991dbf
5 changed files with 14 additions and 8 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <AK/InlineLinkedList.h>
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <Kernel/FileSystem/InodeMetadata.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/Lock.h>
|
||||
|
@ -479,7 +480,7 @@ private:
|
|||
NonnullOwnPtrVector<Region> m_regions;
|
||||
struct RegionLookupCache {
|
||||
Range range;
|
||||
Region* region { nullptr };
|
||||
WeakPtr<Region> region;
|
||||
};
|
||||
RegionLookupCache m_region_lookup_cache;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue