From: David Majnemer Date: Thu, 11 Dec 2014 20:44:09 +0000 (+0000) Subject: AsmParser: Don't crash on an ill-formed MDNodeVector X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=ff3fa3dc00c6a792d8f7a09c62e740f4e09f042a;p=oota-llvm.git AsmParser: Don't crash on an ill-formed MDNodeVector git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224053 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index ca4ba6e07f3..ae007ce3693 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -4686,8 +4686,8 @@ int LLParser::ParseInsertValue(Instruction *&Inst, PerFunctionState &PFS) { /// ::= 'null' | TypeAndValue bool LLParser::ParseMDNodeVector(SmallVectorImpl &Elts, PerFunctionState *PFS) { - assert(Lex.getKind() == lltok::lbrace); - Lex.Lex(); + if (ParseToken(lltok::lbrace, "expected '{' here")) + return true; // Check for an empty list. if (EatIfPresent(lltok::rbrace)) diff --git a/test/Assembler/invalid-mdnode-vector.ll b/test/Assembler/invalid-mdnode-vector.ll new file mode 100644 index 00000000000..411cae7faa8 --- /dev/null +++ b/test/Assembler/invalid-mdnode-vector.ll @@ -0,0 +1,4 @@ +; RUN: not llvm-as < %s 2>&1 | FileCheck %s + +!0 = metadata! +; CHECK: expected '{' here