template <class ValueType, class SizeType>
class CheckedAddressRangeGeneric
Defined at line 39 of file ../../third_party/crashpad/src/util/numeric/checked_address_range.h
Ensures that a range, composed of a base and a size, does not
overflow the pointer type of the process it describes a range in.
This class checks bases of type `ValueType` and sizes of type `SizeType`
against a process whose pointer type is either 32 or 64 bits wide.
Aside from varying the overall range on the basis of a process’ pointer type
width, this class functions very similarly to CheckedRange.
Public Methods
void CheckedAddressRangeGeneric<ValueType, SizeType> ()
Initializes a default range.
The default range has base 0, size 0, and appears to be from a 32-bit
process.
void CheckedAddressRangeGeneric<ValueType, SizeType> (bool is_64_bit, ValueType base, SizeType size)
Initializes a range.
See SetRange().
void SetRange (bool is_64_bit, ValueType base, SizeType size)
Sets a range’s fields.
Parameters
ValueType Base ()
The range’s base address.
SizeType Size ()
The range’s size.
ValueType End ()
The range’s end address (its base address plus its size).
bool Is64Bit ()
Returns whether this range refers to a 64-bit process.
Defined at line 80 of file ../../third_party/crashpad/src/util/numeric/checked_address_range.h
bool IsValid ()
Returns the validity of the address range.
An address range is valid if its size can be converted to the address
range’s data type without data loss, and if its end (base plus size) can
be computed without overflowing its data type.
Returns
`true` if the address range is valid, `false` otherwise.
bool ContainsValue (const ValueType value)
Returns whether the address range contains another address.
An address range contains a value if the value is greater than or equal to
its base address, and less than its end address (base address plus size).
This method must only be called if IsValid() would return `true`.
Parameters
Returns
`true` if the address range contains
`false` otherwise.
bool ContainsRange (const CheckedAddressRangeGeneric<ValueType, SizeType> & that)
Returns whether the address range contains another address range.
An address range contains another address range when the contained address
range’s base is greater than or equal to the containing address range’s
base, and the contained address range’s end is less than or equal to the
containing address range’s end.
This method should only be called on two CheckedAddressRangeGeneric
objects representing address ranges in the same process.
This method must only be called if IsValid() would return `true` for both
CheckedAddressRangeGeneric objects involved.
Parameters
Returns
`true` if `this` address range, the containing address range,
contains
the contained address range. `false` otherwise.
std::string AsString ()
Returns a string describing the address range.
The string will be formatted as `"0x123 + 0x45 (64)"`, where the
individual components are the address, size, and bitness.