mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-25 01:18:22 +08:00
Check partitions size before erasing to avoid memory corruption
This commit is contained in:
parent
aa3e790fb1
commit
6875968d97
@ -4220,6 +4220,9 @@ USTATUS FfsParser::parseBpdtRegion(const UByteArray & region, const UINT32 local
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_partition_table_consistent:
|
make_partition_table_consistent:
|
||||||
|
if (partitions.empty()) {
|
||||||
|
return U_INVALID_ME_PARTITION_TABLE;
|
||||||
|
}
|
||||||
// Sort partitions by offset
|
// Sort partitions by offset
|
||||||
std::sort(partitions.begin(), partitions.end());
|
std::sort(partitions.begin(), partitions.end());
|
||||||
|
|
||||||
@ -4521,6 +4524,9 @@ USTATUS FfsParser::parseCpdRegion(const UByteArray & region, const UINT32 localO
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_partition_table_consistent:
|
make_partition_table_consistent:
|
||||||
|
if (partitions.empty()) {
|
||||||
|
return U_INVALID_ME_PARTITION_TABLE;
|
||||||
|
}
|
||||||
// Sort partitions by offset
|
// Sort partitions by offset
|
||||||
std::sort(partitions.begin(), partitions.end());
|
std::sort(partitions.begin(), partitions.end());
|
||||||
|
|
||||||
|
@ -223,7 +223,9 @@ USTATUS MeParser::parseFptRegion(const UByteArray & region, const UModelIndex &
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_partition_table_consistent:
|
make_partition_table_consistent:
|
||||||
|
if (partitions.empty()) {
|
||||||
|
return U_INVALID_ME_PARTITION_TABLE;
|
||||||
|
}
|
||||||
// Sort partitions by offset
|
// Sort partitions by offset
|
||||||
std::sort(partitions.begin(), partitions.end());
|
std::sort(partitions.begin(), partitions.end());
|
||||||
|
|
||||||
@ -384,6 +386,9 @@ USTATUS MeParser::parseIfwi16Region(const UByteArray & region, const UModelIndex
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_partition_table_consistent:
|
make_partition_table_consistent:
|
||||||
|
if (partitions.empty()) {
|
||||||
|
return U_INVALID_ME_PARTITION_TABLE;
|
||||||
|
}
|
||||||
// Sort partitions by offset
|
// Sort partitions by offset
|
||||||
std::sort(partitions.begin(), partitions.end());
|
std::sort(partitions.begin(), partitions.end());
|
||||||
|
|
||||||
@ -565,6 +570,9 @@ USTATUS MeParser::parseIfwi17Region(const UByteArray & region, const UModelIndex
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_partition_table_consistent:
|
make_partition_table_consistent:
|
||||||
|
if (partitions.empty()) {
|
||||||
|
return U_INVALID_ME_PARTITION_TABLE;
|
||||||
|
}
|
||||||
// Sort partitions by offset
|
// Sort partitions by offset
|
||||||
std::sort(partitions.begin(), partitions.end());
|
std::sort(partitions.begin(), partitions.end());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user