Skip to content

Commit 8c1dba8

Browse files
committed
[clang][ExprConst] Check for array size of initlists
Fixes #138653
1 parent 0f6b671 commit 8c1dba8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clang/lib/AST/ExprConstant.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11788,6 +11788,11 @@ bool ArrayExprEvaluator::VisitCXXParenListOrInitListExpr(
1178811788
LLVM_DEBUG(llvm::dbgs() << "The number of elements to initialize: "
1178911789
<< NumEltsToInit << ".\n");
1179011790

11791+
if (!Info.CheckArraySize(ExprToVisit->getExprLoc(),
11792+
CAT->getNumAddressingBits(Info.Ctx), NumEltsToInit,
11793+
/*Diag=*/true))
11794+
return false;
11795+
1179111796
Result = APValue(APValue::UninitArray(), NumEltsToInit, NumElts);
1179211797

1179311798
// If the array was previously zero-initialized, preserve the

0 commit comments

Comments
 (0)