summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitf141156e6c1cdb4830a6afd9da7a1482fcc81d51 (patch)
tree190077db7be912d9c53c60e4b9a2243fc226af95 /llvm/lib/Support
parent6d7833f1b6ded15c597be422071080b041acb893 (diff)
downloadbcm5719-llvm-f141156e6c1cdb4830a6afd9da7a1482fcc81d51.tar.gz
bcm5719-llvm-f141156e6c1cdb4830a6afd9da7a1482fcc81d51.zip
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 llvm-svn: 160075
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/MemoryBuffer.cpp10
1 files changed, 0 insertions, 10 deletions
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp
index 37377061aa2..992f03c5205 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/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();
}
}
OpenPOWER on IntegriCloud