diff --git a/common/ffsparser.cpp b/common/ffsparser.cpp index 6701926..9d48b6f 100644 --- a/common/ffsparser.cpp +++ b/common/ffsparser.cpp @@ -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()); diff --git a/common/meparser.cpp b/common/meparser.cpp index e4d2280..0309406 100755 --- a/common/meparser.cpp +++ b/common/meparser.cpp @@ -223,7 +223,9 @@ USTATUS MeParser::parseFptRegion(const UByteArray & region, const UModelIndex & } make_partition_table_consistent: - + if (partitions.empty()) { + return U_INVALID_ME_PARTITION_TABLE; + } // Sort partitions by offset std::sort(partitions.begin(), partitions.end()); @@ -384,6 +386,9 @@ USTATUS MeParser::parseIfwi16Region(const UByteArray & region, const UModelIndex } make_partition_table_consistent: + if (partitions.empty()) { + return U_INVALID_ME_PARTITION_TABLE; + } // Sort partitions by offset std::sort(partitions.begin(), partitions.end()); @@ -565,6 +570,9 @@ USTATUS MeParser::parseIfwi17Region(const UByteArray & region, const UModelIndex } make_partition_table_consistent: + if (partitions.empty()) { + return U_INVALID_ME_PARTITION_TABLE; + } // Sort partitions by offset std::sort(partitions.begin(), partitions.end());