|
clang 24.0.0git
|
Public Member Functions | |
| bool | isCorruptedState () const |
| When true, the bounds check noticed that the value of an unsigned expression is constrained to negative values (because the analyzer skipped the modeling of a cast expression). | |
| bool | mayBeInBounds () const |
| When true, the checked offset may be in bounds. | |
| bool | mayUnderflow () const |
| When true, the checked offset may be negative. | |
| bool | mayOverflow () const |
| When true, the checked offset may be >= the extent of the region. | |
| bool | mayBeInvalid () const |
| When true, the checked offset may be out of bounds. | |
| NonLoc | getOffset () const |
| Returns the offset of the accessed location from the beginning of the accessd region. | |
| std::optional< NonLoc > | getExtentIfMayOverflow () const |
| Returns the extent of the accessed region if it is relevant (because the offset may overflow it), otherwise returns std::nullopt. | |
| ProgramStateRef | getInBoundsState () const |
| Returns the program state that should be used for continuing the analysis after this bounds check. | |
Friends | |
| CheckResult | checkBounds (ProgramStateRef State, SValBuilder &SVB, NonLoc Offset, std::optional< NonLoc > Extent, CheckFlags Flags) |
Checks the validity of accessing a memory region with extent Extent at offset Offset. | |
Definition at line 137 of file ArrayBoundChecker.cpp.
|
inline |
Returns the extent of the accessed region if it is relevant (because the offset may overflow it), otherwise returns std::nullopt.
Definition at line 167 of file ArrayBoundChecker.cpp.
Referenced by describeInvalidAccess(), and getAssumptionNote().
|
inline |
Returns the program state that should be used for continuing the analysis after this bounds check.
This returns null if mayBeInBounds() is false, in that case the state before the check should be used in the error node. Note that we also have a valid state in the exception case when the 'access' calculates the past-the-end pointer without dereferencing it.
Definition at line 176 of file ArrayBoundChecker.cpp.
|
inline |
Returns the offset of the accessed location from the beginning of the accessd region.
Definition at line 163 of file ArrayBoundChecker.cpp.
Referenced by describeInvalidAccess(), and getAssumptionNote().
|
inline |
When true, the bounds check noticed that the value of an unsigned expression is constrained to negative values (because the analyzer skipped the modeling of a cast expression).
This execution path must be discarded because it does not represent a real possibility. FIXME: This hack is currently needed to filter out many ugly false positives; but it should be removed when we fix cast modeling.
Definition at line 145 of file ArrayBoundChecker.cpp.
|
inline |
When true, the checked offset may be in bounds.
As an exceptional case, this is also true for idiomatic expressions that define a past-the-end pointer (and do not dereference it).
Definition at line 150 of file ArrayBoundChecker.cpp.
|
inline |
When true, the checked offset may be out of bounds.
Definition at line 159 of file ArrayBoundChecker.cpp.
|
inline |
When true, the checked offset may be >= the extent of the region.
As an exceptional case, this is also false for idiomatic expressions that define a past-the-end pointer (and do not dereference it).
Definition at line 157 of file ArrayBoundChecker.cpp.
Referenced by describeInvalidAccess(), and getAssumptionNote().
|
inline |
When true, the checked offset may be negative.
Definition at line 153 of file ArrayBoundChecker.cpp.
Referenced by describeInvalidAccess(), and getAssumptionNote().
|
friend |
Checks the validity of accessing a memory region with extent Extent at offset Offset.
The Flags influence the semantics of the check, in particular if AcceptPastTheEnd is true, then Offset == Extent is also accepted as valid.