summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-05-30 08:03:02 +0000
committerFangrui Song <maskray@google.com>2019-05-30 08:03:02 +0000
commit9b8a0d7110e97db67f48368ee623d06cbb6075a5 (patch)
treea7f478b36a70243584fb5a8f90cbb8f9a0fe84ce
parentbb4839d4157b3dc2552687f2e6dcb20245d2988e (diff)
downloadbcm5719-llvm-9b8a0d7110e97db67f48368ee623d06cbb6075a5.tar.gz
bcm5719-llvm-9b8a0d7110e97db67f48368ee623d06cbb6075a5.zip
asm goto: fix out-of-bounds read of Constraints after rC362045
When parsing goto labels, Names and Exprs are expanded but Constraints is not, this may cause a out-of-bounds read later in: // GCCAsmStmt::GCCAsmStmt // `constraints` has only `NumExprs - NumLabels` elements Constraints = new (C) StringLiteral*[NumExprs]; std::copy(constraints, constraints + NumExprs, Constraints); llvm-svn: 362067
-rw-r--r--clang/lib/Parse/ParseStmtAsm.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseStmtAsm.cpp b/clang/lib/Parse/ParseStmtAsm.cpp
index 75f3ac396e1..e1c48da5f2b 100644
--- a/clang/lib/Parse/ParseStmtAsm.cpp
+++ b/clang/lib/Parse/ParseStmtAsm.cpp
@@ -846,6 +846,7 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) {
ExprResult Res =
Actions.ActOnAddrLabel(Tok.getLocation(), Tok.getLocation(), LD);
Exprs.push_back(Res.get());
+ Constraints.emplace_back();
NumLabels++;
ConsumeToken();
if (!TryConsumeToken(tok::comma))
OpenPOWER on IntegriCloud