mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-04 03:44:59 +00:00
[scudo] Fix bound checks in MemMap and ReservedMemory methods
Reviewed By: Chia-hungDuan Differential Revision: https://reviews.llvm.org/D152690
This commit is contained in:
parent
1ae6a782f0
commit
bd96d7b81f
@ -41,7 +41,7 @@ public:
|
||||
// want to remap them with different accessibility.
|
||||
bool remap(uptr Addr, uptr Size, const char *Name, uptr Flags = 0) {
|
||||
DCHECK(isAllocated());
|
||||
DCHECK((Addr >= getBase()) || (Addr + Size <= getBase() + getCapacity()));
|
||||
DCHECK((Addr >= getBase()) && (Addr + Size <= getBase() + getCapacity()));
|
||||
return invokeImpl(&Derived::remapImpl, Addr, Size, Name, Flags);
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
// pages as no read/write permission.
|
||||
void setMemoryPermission(uptr Addr, uptr Size, uptr Flags) {
|
||||
DCHECK(isAllocated());
|
||||
DCHECK((Addr >= getBase()) || (Addr + Size <= getBase() + getCapacity()));
|
||||
DCHECK((Addr >= getBase()) && (Addr + Size <= getBase() + getCapacity()));
|
||||
return static_cast<Derived *>(this)->setMemoryPermissionImpl(Addr, Size,
|
||||
Flags);
|
||||
}
|
||||
@ -59,14 +59,14 @@ public:
|
||||
// virtual pages may lead to undefined behavior.
|
||||
void releasePagesToOS(uptr From, uptr Size) {
|
||||
DCHECK(isAllocated());
|
||||
DCHECK((From >= getBase()) || (From + Size <= getBase() + getCapacity()));
|
||||
DCHECK((From >= getBase()) && (From + Size <= getBase() + getCapacity()));
|
||||
invokeImpl(&Derived::releasePagesToOSImpl, From, Size);
|
||||
}
|
||||
// This is similar to the above one except that any subsequent access to the
|
||||
// released pages will return with zero-filled pages.
|
||||
void releaseAndZeroPagesToOS(uptr From, uptr Size) {
|
||||
DCHECK(isAllocated());
|
||||
DCHECK((From >= getBase()) || (From + Size <= getBase() + getCapacity()));
|
||||
DCHECK((From >= getBase()) && (From + Size <= getBase() + getCapacity()));
|
||||
invokeImpl(&Derived::releaseAndZeroPagesToOSImpl, From, Size);
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ public:
|
||||
// the reserved pages is managed by each implementation.
|
||||
MemMapT dispatch(uptr Addr, uptr Size) {
|
||||
DCHECK(isCreated());
|
||||
DCHECK((Addr >= getBase()) || (Addr + Size <= getBase() + getCapacity()));
|
||||
DCHECK((Addr >= getBase()) && (Addr + Size <= getBase() + getCapacity()));
|
||||
return invokeImpl(&Derived::dispatchImpl, Addr, Size);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user