diff options
Diffstat (limited to 'llvm/lib/BinaryFormat/Magic.cpp')
-rw-r--r-- | llvm/lib/BinaryFormat/Magic.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/BinaryFormat/Magic.cpp b/llvm/lib/BinaryFormat/Magic.cpp index b19a07a..e9b8df9 100644 --- a/llvm/lib/BinaryFormat/Magic.cpp +++ b/llvm/lib/BinaryFormat/Magic.cpp @@ -182,7 +182,7 @@ file_magic llvm::identify_magic(StringRef Magic) { break; case 'M': // Possible MS-DOS stub on Windows PE file - if (startswith(Magic, "MZ")) { + if (startswith(Magic, "MZ") && Magic.size() >= 0x3c + 4) { uint32_t off = read32le(Magic.data() + 0x3c); // PE/COFF file, either EXE or DLL. if (off < Magic.size() && |