mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-02 08:11:54 +00:00
[llvm-pdbdump] Try to appease the ASan bot
We didn't check that the file was large enough to hold a super block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267965 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5f1ec2bfa8
commit
7fdc84bb3c
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user