Author: maskray Date: Thu May 30 01:03:02 2019 New Revision: 362067 URL: http://llvm.org/viewvc/llvm-project?rev=362067&view=rev Log: 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); Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=362067&r1=362066&r2=362067&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original) +++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Thu May 30 01:03:02 2019 @@ -846,6 +846,7 @@ StmtResult Parser::ParseAsmStatement(boo ExprResult Res = Actions.ActOnAddrLabel(Tok.getLocation(), Tok.getLocation(), LD); Exprs.push_back(Res.get()); + Constraints.emplace_back(); NumLabels++; ConsumeToken(); if (!TryConsumeToken(tok::comma)) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits