From 6f3be2e155193c12f7da1d78a780f8644fd8b3f5 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 10 Dec 2014 02:10:35 +0000 Subject: AsmParser: Don't allow null bytes in BB labels Since Value objects can't have null bytes in their name, we shouldn't allow them in the labels of basic blocks. llvm-svn: 223907 --- llvm/lib/AsmParser/LLLexer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'llvm/lib/AsmParser') diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index cd7f09b8933..ca3c9e8b6f8 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -393,7 +393,12 @@ lltok::Kind LLLexer::LexQuote() { if (CurPtr[0] == ':') { ++CurPtr; - kind = lltok::LabelStr; + if (StringRef(StrVal).find_first_of(0) != StringRef::npos) { + Error("Null bytes are not allowed in names"); + kind = lltok::Error; + } else { + kind = lltok::LabelStr; + } } return kind; -- cgit v1.2.3