summaryrefslogtreecommitdiff
path: root/lib/AsmParser
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-11-19 21:12:39 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-11-19 21:12:39 +0000
commitedeaa6454ef1dc29fa3144b93e2121495b160b35 (patch)
treebeb9ac26a0bd4914e84b584d2466c6923cf60851 /lib/AsmParser
parenta49e1f55da902fe1b50e3ea989357d3e70b24dc9 (diff)
downloadllvm-edeaa6454ef1dc29fa3144b93e2121495b160b35.tar.gz
llvm-edeaa6454ef1dc29fa3144b93e2121495b160b35.tar.bz2
llvm-edeaa6454ef1dc29fa3144b93e2121495b160b35.tar.xz
Make it explicit that nulls are not allowed in names.
The object files we support use null terminated strings, so there is no way to support these. This patch adds an assert to catch bad API use and an error check in the .ll parser. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195155 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r--lib/AsmParser/LLLexer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp
index 1e6085b443..3c384f5fcc 100644
--- a/lib/AsmParser/LLLexer.cpp
+++ b/lib/AsmParser/LLLexer.cpp
@@ -275,6 +275,10 @@ lltok::Kind LLLexer::LexAt() {
if (CurChar == '"') {
StrVal.assign(TokStart+2, CurPtr-1);
UnEscapeLexed(StrVal);
+ if (StringRef(StrVal).find_first_of(0) != StringRef::npos) {
+ Error("Null bytes are not allowed in names");
+ return lltok::Error;
+ }
return lltok::GlobalVar;
}
}