[llvm] [llvm] Bail out when meeting pointer with negative offset instead of … (PR #120424)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 05:51:52 PST 2024
================
@@ -838,11 +838,14 @@ OffsetSpan ObjectSizeOffsetVisitor::computeImpl(Value *V) {
// We end up pointing on a location that's outside of the original object.
if (ORT.knownBefore() && ORT.Before.isNegative()) {
- // This is UB, and we'd rather return an empty location then.
+ // This means that we *may* be accessing memory before the allocation. It's
+ // unsure though, so bail out instead of returning a potentially misleading
+ // result.
----------------
fhahn wrote:
```suggestion
// This means that we *may* be accessing memory before the allocation. Conservatively return an unknown size.
```
https://github.com/llvm/llvm-project/pull/120424
More information about the llvm-commits
mailing list