summaryrefslogtreecommitdiff
path: root/lib/Support
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-07-11 20:59:20 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-07-11 20:59:20 +0000
commit10dedb9421467f2813195bcd9c81aca508a1875b (patch)
tree06b606a4365241e1563d6dc5f95ca485a5a1c4d4 /lib/Support
parentf9fa3d8b872639d494481b43bee158c4359fc626 (diff)
downloadllvm-10dedb9421467f2813195bcd9c81aca508a1875b.tar.gz
llvm-10dedb9421467f2813195bcd9c81aca508a1875b.tar.bz2
llvm-10dedb9421467f2813195bcd9c81aca508a1875b.tar.xz
In MemoryBuffer::getOpenFile() don't verify that the mmap'ed
file buffer is null-terminated. If the file is smaller than we thought, mmap will not allow dereferencing past the pages that are enough to cover the actual file size, even though we asked for a larger address range. rdar://11612916 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160075 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/MemoryBuffer.cpp10
1 files changed, 0 insertions, 10 deletions
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp
index 37377061aa..992f03c520 100644
--- a/lib/Support/MemoryBuffer.cpp
+++ b/lib/Support/MemoryBuffer.cpp
@@ -313,16 +313,6 @@ error_code MemoryBuffer::getOpenFile(int FD, const char *Filename,
RealMapOffset)) {
result.reset(GetNamedBuffer<MemoryBufferMMapFile>(
StringRef(Pages + Delta, MapSize), Filename, RequiresNullTerminator));
-
- if (RequiresNullTerminator && result->getBufferEnd()[0] != '\0') {
- // There could be a racing issue that resulted in the file being larger
- // than the FileSize passed by the caller. We already have an assertion
- // for this in MemoryBuffer::init() but have a runtime guarantee that
- // the buffer will be null-terminated here, so do a copy that adds a
- // null-terminator.
- result.reset(MemoryBuffer::getMemBufferCopy(result->getBuffer(),
- Filename));
- }
return error_code::success();
}
}