Skip to content

Commit b07298e

Browse files
author
Zachary Turner
committed
Use RequireNullTerminator=false in identify_magic.
identify_magic does not need the file to be null terminated. Passing true here causes the file reading code to decide not to use mmap in some rare cases (which happen to be true 100% of the time in PDB files) which can lead to very large files failing to load. Since it was probably just an accident that we were passing true here (since it is the default function parameter), this should be strictly an improvement. llvm-svn: 348059
1 parent ba968c0 commit b07298e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/BinaryFormat/Magic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ file_magic llvm::identify_magic(StringRef Magic) {
206206
}
207207

208208
std::error_code llvm::identify_magic(const Twine &Path, file_magic &Result) {
209-
auto FileOrError = MemoryBuffer::getFile(Path);
209+
auto FileOrError = MemoryBuffer::getFile(Path, -1LL, false);
210210
if (!FileOrError)
211211
return FileOrError.getError();
212212

0 commit comments

Comments
 (0)