diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-12-09 02:44:48 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-12-09 02:44:48 +0000 |
commit | 42786839cff1ccbe4d883b81d01846c5d774ffc6 (patch) | |
tree | c2ddbdf13094a360f04fe3408e0eb3c3ffc37c39 /lib/AST/ExprConstant.cpp | |
parent | e052d46f4db91f9ba572859ffc984e85cbf5d5ff (diff) |
In ExprEvaluatorBase::VisitOpaqueValueExpr() add a sanity check to avoid
infinite recursion due to bad OpaqueValueExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146237 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index cbb75db255..c095f2166d 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -1557,9 +1557,16 @@ public: RetTy VisitOpaqueValueExpr(const OpaqueValueExpr *E) { const CCValue *Value = Info.getOpaqueValue(E); - if (!Value) - return (E->getSourceExpr() ? StmtVisitorTy::Visit(E->getSourceExpr()) - : DerivedError(E)); + if (!Value) { + const Expr *Source = E->getSourceExpr(); + if (!Source) + return DerivedError(E); + if (Source == E) { // sanity checking. + assert(0 && "OpaqueValueExpr recursively refers to itself"); + return DerivedError(E); + } + return StmtVisitorTy::Visit(Source); + } return DerivedSuccess(*Value, E); } |