summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pnor_partition_table.cpp25
-rw-r--r--test/vpnor/Makefile.am.include2
2 files changed, 25 insertions, 2 deletions
diff --git a/pnor_partition_table.cpp b/pnor_partition_table.cpp
index 67b32f1..c9d56a2 100644
--- a/pnor_partition_table.cpp
+++ b/pnor_partition_table.cpp
@@ -99,6 +99,31 @@ void Table::preparePartitions()
parseTocLine(line, blockSize, part);
+ if (numParts > 0)
+ {
+ struct pnor_partition& prev = table.partitions[numParts - 1];
+ uint32_t prev_end = prev.data.base + prev.data.size;
+
+ if (part.data.id == prev.data.id)
+ {
+ MSG_ERR("ID for previous partition '%s' at block 0x%" PRIx32
+ "matches current partition '%s' at block 0x%" PRIx32
+ ": %" PRId32 "\n",
+ prev.data.name, prev.data.base, part.data.name,
+ part.data.base, part.data.id);
+ }
+
+ if (part.data.base < prev_end)
+ {
+ std::stringstream err;
+ err << "Partition '" << part.data.name << "' start block 0x"
+ << std::hex << part.data.base << "is less than the end "
+ << "block 0x" << std::hex << prev_end << " of '"
+ << prev.data.name << "'";
+ throw InvalidTocEntry(err.str());
+ }
+ }
+
file = directory / part.data.name;
if (!fs::exists(file))
{
diff --git a/test/vpnor/Makefile.am.include b/test/vpnor/Makefile.am.include
index 6765b02..831b146 100644
--- a/test/vpnor/Makefile.am.include
+++ b/test/vpnor/Makefile.am.include
@@ -137,6 +137,4 @@ check_PROGRAMS += \
%reldir%/toc_no_version \
%reldir%/toc_flags \
%reldir%/toc_overlap
-
-XFAIL_TESTS += %reldir%/toc_overlap
endif
OpenPOWER on IntegriCloud