diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-04-29 01:00:17 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-04-29 01:00:17 +0000 |
commit | ca9ac4721d35aa3926b16ea0d663582394968b4d (patch) | |
tree | f434823d25b16f00ab0a10fb180ec4335207f9a1 /llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp | |
parent | 184310d6a91a1a51b7abb0e1050b3076278deab7 (diff) | |
download | llvm-ca9ac4721d35aa3926b16ea0d663582394968b4d.zip llvm-ca9ac4721d35aa3926b16ea0d663582394968b4d.tar.gz llvm-ca9ac4721d35aa3926b16ea0d663582394968b4d.tar.bz2 |
[llvm-pdbdump] Try to appease the ASan bot
We didn't check that the file was large enough to hold a super block.
llvm-svn: 267965
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp index be1368e..0adabfe 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp @@ -122,6 +122,11 @@ std::error_code PDBFile::parseFileHeaders() { Context->SB = reinterpret_cast<const SuperBlock *>(BufferRef.getBufferStart()); const SuperBlock *SB = Context->SB; + + // Make sure the file is sufficiently large to hold a super block. + if (BufferRef.getBufferSize() < sizeof(SuperBlock)) + return std::make_error_code(std::errc::illegal_byte_sequence); + // Check the magic bytes. if (memcmp(SB->MagicBytes, Magic, sizeof(Magic)) != 0) return std::make_error_code(std::errc::illegal_byte_sequence); |