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://review.tizen.org/git/?a=commitdiff_plain;h=06f960d5d35adec2d098d68e733b529c79c20876;p=platform%2Fupstream%2Fllvm.git AsmParser: Don't crash on an ill-formed MDNodeVector llvm-svn: 224053 --- diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index ca4ba6e..ae007ce 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/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/llvm/test/Assembler/invalid-mdnode-vector.ll b/llvm/test/Assembler/invalid-mdnode-vector.ll new file mode 100644 index 0000000..411cae7 --- /dev/null +++ b/llvm/test/Assembler/invalid-mdnode-vector.ll @@ -0,0 +1,4 @@ +; RUN: not llvm-as < %s 2>&1 | FileCheck %s + +!0 = metadata! +; CHECK: expected '{' here