diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-17 08:01:34 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-17 08:01:34 +0000 |
| commit | 51ce8444f0eccd7d61177664374e6f0bb2a557fa (patch) | |
| tree | 64a3d2b08481bfffcd696183c477a1fa51e410e6 /clang/lib/AST/ExprConstant.cpp | |
| parent | 77483765eb77b3f15b03ef1d876d4356623aa460 (diff) | |
| download | bcm5719-llvm-51ce8444f0eccd7d61177664374e6f0bb2a557fa.tar.gz bcm5719-llvm-51ce8444f0eccd7d61177664374e6f0bb2a557fa.zip | |
Fix crash if, during evaluation of __builtin_object_size, we try to load
through an invalid base.
llvm-svn: 360998
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index e41264e55e4..236827280ef 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -3285,6 +3285,11 @@ static bool AreElementsOfSameArray(QualType ObjType, static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E, AccessKinds AK, const LValue &LVal, QualType LValType) { + if (LVal.InvalidBase) { + Info.FFDiag(E); + return CompleteObject(); + } + if (!LVal.Base) { Info.FFDiag(E, diag::note_constexpr_access_null) << AK; return CompleteObject(); |

