diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-11-11 23:10:10 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-11-11 23:10:10 +0000 |
commit | 29836f9e4750f1ccb72c24f661c20686507f0063 (patch) | |
tree | 86cfbbac1195cbdc92eecabf5da79da2930ef05f /lib/Checker/RegionStore.cpp | |
parent | 8c457a8395676692225cd4c90bfb54d430199fdf (diff) |
RegionStore/BasicStore: do not return UndefinedVal for accesses to concrete addresses; instead return UnknownVal. This
leads it up to checkers (e.g., DereferenceChecker) to guard against illegal accesses (e.g., null dereferences).
Fixes PR 5272 and <rdar://problem/6839683>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118852 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/RegionStore.cpp')
-rw-r--r-- | lib/Checker/RegionStore.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Checker/RegionStore.cpp b/lib/Checker/RegionStore.cpp index 231be0af18..7808872f5d 100644 --- a/lib/Checker/RegionStore.cpp +++ b/lib/Checker/RegionStore.cpp @@ -952,10 +952,15 @@ SVal RegionStoreManager::Retrieve(Store store, Loc L, QualType T) { assert(!isa<UnknownVal>(L) && "location unknown"); assert(!isa<UndefinedVal>(L) && "location undefined"); - // FIXME: Is this even possible? Shouldn't this be treated as a null - // dereference at a higher level? - if (isa<loc::ConcreteInt>(L)) - return UndefinedVal(); + // For access to concrete addresses, return UnknownVal. Checks + // for null dereferences (and similar errors) are done by checkers, not + // the Store. + // FIXME: We can consider lazily symbolicating such memory, but we really + // should defer this when we can reason easily about symbolicating arrays + // of bytes. + if (isa<loc::ConcreteInt>(L)) { + return UnknownVal(); + } const MemRegion *MR = cast<loc::MemRegionVal>(L).getRegion(); |