The class seems to have an invariant that Entries is non-empty if
Invalid is false. It appears this method was previously private, and
all internal uses checked Invalid. Now there is an external caller, so
check Invalid to avoid array OOB underflow.
Fixes PR20420.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213816
91177308-0d34-0410-b5e6-
96231b3b80d8
/// Determine whether this is a one-past-the-end pointer.
bool isOnePastTheEnd() const {
+ if (Invalid)
+ return false;
if (IsOnePastTheEnd)
return true;
if (MostDerivedArraySize &&
};
E e;
}
+
+namespace pr20420 {
+// No warning is expected. This used to crash.
+void *array_storage[1];
+const int &global_reference = *(int *)array_storage;
+}