mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-03 17:24:24 +00:00
[PDB] Validate superblock addresses
- Validate the address of the block map. - Validate the address of the free block map. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290053 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0f11f29f4b
commit
9b671f3db3
@ -44,5 +44,14 @@ Error llvm::msf::validateSuperBlock(const SuperBlock &SB) {
|
||||
return make_error<MSFError>(msf_error_code::invalid_format,
|
||||
"Block 0 is reserved");
|
||||
|
||||
if (SB.BlockMapAddr >= SB.NumBlocks)
|
||||
return make_error<MSFError>(msf_error_code::invalid_format,
|
||||
"Block map address is invalid.");
|
||||
|
||||
if (SB.FreeBlockMapBlock != 1 && SB.FreeBlockMapBlock != 2)
|
||||
return make_error<MSFError>(
|
||||
msf_error_code::invalid_format,
|
||||
"The free block map isn't at block 1 or block 2.");
|
||||
|
||||
return Error::success();
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ protected:
|
||||
::memset(&SB, 0, sizeof(SB));
|
||||
|
||||
::memcpy(SB.MagicBytes, msf::Magic, sizeof(msf::Magic));
|
||||
SB.FreeBlockMapBlock = 1;
|
||||
SB.BlockMapAddr = 1;
|
||||
SB.BlockSize = 4096;
|
||||
SB.NumDirectoryBytes = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user