mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-12 22:26:13 -04:00
Check partitions size before erasing to avoid memory corruption
This commit is contained in:
parent
aa3e790fb1
commit
6875968d97
2 changed files with 15 additions and 1 deletions
|
@ -4220,6 +4220,9 @@ USTATUS FfsParser::parseBpdtRegion(const UByteArray & region, const UINT32 local
|
|||
}
|
||||
|
||||
make_partition_table_consistent:
|
||||
if (partitions.empty()) {
|
||||
return U_INVALID_ME_PARTITION_TABLE;
|
||||
}
|
||||
// Sort partitions by offset
|
||||
std::sort(partitions.begin(), partitions.end());
|
||||
|
||||
|
@ -4521,6 +4524,9 @@ USTATUS FfsParser::parseCpdRegion(const UByteArray & region, const UINT32 localO
|
|||
}
|
||||
|
||||
make_partition_table_consistent:
|
||||
if (partitions.empty()) {
|
||||
return U_INVALID_ME_PARTITION_TABLE;
|
||||
}
|
||||
// Sort partitions by offset
|
||||
std::sort(partitions.begin(), partitions.end());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue