From c6277793dd0e8d045a5bfc64a18236217ac1680a Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Wed, 20 May 2015 20:41:27 +0000 Subject: AsmParser: Require a terminating null character when creating memory buffer. This commit modifies the memory buffer creation in the AsmParser library so that it requires a terminating null character. The LLLexer in the AsmParser library checks for EOF only when it sees a null character, thus it would be best to require it when creating a memory buffer so that the memory buffer constructor can verify that a terminating null character is indeed present. Reviewers: Duncan P. N. Exon Smith, Matthias Braun Differential Revision: http://reviews.llvm.org/D9883 llvm-svn: 237833 --- llvm/lib/AsmParser/Parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/AsmParser/Parser.cpp') diff --git a/llvm/lib/AsmParser/Parser.cpp b/llvm/lib/AsmParser/Parser.cpp index 2e76c0ecc45..c55a6a1e243 100644 --- a/llvm/lib/AsmParser/Parser.cpp +++ b/llvm/lib/AsmParser/Parser.cpp @@ -24,7 +24,7 @@ using namespace llvm; bool llvm::parseAssemblyInto(MemoryBufferRef F, Module &M, SMDiagnostic &Err) { SourceMgr SM; - std::unique_ptr Buf = MemoryBuffer::getMemBuffer(F, false); + std::unique_ptr Buf = MemoryBuffer::getMemBuffer(F); SM.AddNewSourceBuffer(std::move(Buf), SMLoc()); return LLParser(F.getBuffer(), SM, Err, &M).Run(); -- cgit v1.2.3