mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-13 22:54:47 -04:00
Fix a possible crash of MeParser in case there are no valid FPT partition table entries
This commit is contained in:
parent
a4a455d0ff
commit
011647aa30
2 changed files with 24 additions and 12 deletions
|
@ -212,8 +212,18 @@ USTATUS MeParser::parseFptRegion(const UByteArray & region, const UModelIndex &
|
|||
partitions.push_back(partition);
|
||||
}
|
||||
}
|
||||
// Check for empty set of partitions
|
||||
if (partitions.empty()) {
|
||||
// Add a single padding partition in this case
|
||||
FPT_PARTITION_INFO padding = {};
|
||||
padding.ptEntry.Offset = offset;
|
||||
padding.ptEntry.Size = (UINT32)(region.size() - padding.ptEntry.Offset);
|
||||
padding.type = Types::Padding;
|
||||
partitions.push_back(padding);
|
||||
}
|
||||
|
||||
make_partition_table_consistent:
|
||||
|
||||
// Sort partitions by offset
|
||||
std::sort(partitions.begin(), partitions.end());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue