diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-07-23 23:24:25 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-07-23 23:24:25 +0000 |
commit | 142dd46c2a3d820abbb021225b61c9f13633deff (patch) | |
tree | 917c3e4b96959767ba2b8589885ce6335b72b00a /clang/lib/AST/ExprConstant.cpp | |
parent | edc60376edcc86bbfac132306581b10f3948af69 (diff) | |
download | bcm5719-llvm-142dd46c2a3d820abbb021225b61c9f13633deff.tar.gz bcm5719-llvm-142dd46c2a3d820abbb021225b61c9f13633deff.zip |
Add a missing Invalid check to SubobjectDesignator::isOnePastEnd()
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.
llvm-svn: 213816
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index b1d22658728..11789aa037f 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -201,6 +201,8 @@ namespace { /// Determine whether this is a one-past-the-end pointer. bool isOnePastTheEnd() const { + if (Invalid) + return false; if (IsOnePastTheEnd) return true; if (MostDerivedArraySize && |