Skip to content

Commit 198d9b0

Browse files
committed
Safer IsText option.
1 parent f2654ae commit 198d9b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Support/MemoryBuffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ getOpenFileImpl(sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize,
509509
// from the page cache that are not properly filled with trailing zeroes,
510510
// if some prior user of the page wrote non-zero bytes. Detect this and
511511
// don't use mmap in that case.
512-
if (!IsText || *Result->getBufferEnd() == '\0')
512+
if (!IsText || !RequiresNullTerminator || *Result->getBufferEnd() == '\0')
513513
return std::move(Result);
514514
}
515515
}

0 commit comments

Comments
 (0)