summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Analysis/RegionStore.cpp2
-rw-r--r--clang/test/Analysis/outofbound.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp
index 73b25955c14..99c225f5e83 100644
--- a/clang/lib/Analysis/RegionStore.cpp
+++ b/clang/lib/Analysis/RegionStore.cpp
@@ -275,7 +275,7 @@ SVal RegionStoreManager::getSizeInElements(const GRState* St,
const StringLiteral* Str = SR->getStringLiteral();
// We intentionally made the size value signed because it participates in
// operations with signed indices.
- return NonLoc::MakeVal(getBasicVals(), Str->getByteLength(), false);
+ return NonLoc::MakeVal(getBasicVals(), Str->getByteLength() + 1, false);
}
if (const AnonTypedRegion* ATR = dyn_cast<AnonTypedRegion>(R)) {
diff --git a/clang/test/Analysis/outofbound.c b/clang/test/Analysis/outofbound.c
index 17608ff1687..6e6e8f033b5 100644
--- a/clang/test/Analysis/outofbound.c
+++ b/clang/test/Analysis/outofbound.c
@@ -2,5 +2,5 @@
char f1() {
char* s = "abcd";
- return s[4]; // expected-warning{{Load or store into an out-of-bound memory position.}}
+ return s[5]; // expected-warning{{Load or store into an out-of-bound memory position.}}
}
OpenPOWER on IntegriCloud