From: David Majnemer Date: Tue, 9 Dec 2014 18:33:57 +0000 (+0000) Subject: AsmParser: Don't crash on malformed attribute groups X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b39e22bdc504ba77e2cd385538b6634808cda66e;p=platform%2Fupstream%2Fllvm.git AsmParser: Don't crash on malformed attribute groups This fixes PR21785. llvm-svn: 223801 --- diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index b0edeb4..a682f97 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -869,7 +869,9 @@ bool LLParser::ParseUnnamedAttrGrp() { LocTy AttrGrpLoc = Lex.getLoc(); Lex.Lex(); - assert(Lex.getKind() == lltok::AttrGrpID); + if (Lex.getKind() != lltok::AttrGrpID) + return TokError("expected attribute group id"); + unsigned VarID = Lex.getUIntVal(); std::vector unused; LocTy BuiltinLoc; diff --git a/llvm/test/Assembler/invalid-attrgrp.ll b/llvm/test/Assembler/invalid-attrgrp.ll new file mode 100644 index 0000000..bf1961aa --- /dev/null +++ b/llvm/test/Assembler/invalid-attrgrp.ll @@ -0,0 +1,4 @@ +; RUN: not llvm-as < %s 2>&1 | FileCheck %s + +attributes +; CHECK: expected attribute group id