From ca9ac4721d35aa3926b16ea0d663582394968b4d Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 29 Apr 2016 01:00:17 +0000 Subject: [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 --- llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/DebugInfo/PDB') diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp index be1368eb94f..0adabfe625c 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(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); -- cgit v1.2.3