fix(esp): disclose partition entries outside the table checksum (#12384)

* fix(esp): disclose partition entries outside the table checksum

* fix(esp): label the partition checksum offset origin

* fix(esp): count partition entries outside the table MD5

The coverage warning was only prose, and it presented the MD5 entry's
table-relative offset without a structured fact. Record
entriesAfterChecksum on the MD5 result, project it as
entries_after_checksum, and keep the warning as presentation.

Co-authored-by: morluto <morluto@users.noreply.github.com>

* fix(esp): accept saved flash inventories without the checksum count

A required entries_after_checksum rejected ESP flash Evidence written
before the field existed. Keep the count exactOptional so omission
stays unknown, and still emit it for new inventories.

Co-authored-by: morluto <morluto@users.noreply.github.com>

---------

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-11-19 11:59:02 -05:00
1 parent 8c3dbd99e1
commit ebd709cef5
7 files changed
+232 -6

No files matched your search

+11 -2
View File
@@ -23,7 +23,10 @@ before it, and a terminating entry within `0xC00` bytes. ESP-IDF accepts a
table with no partition entries, but REA requires one, so that neither
erased flash nor a lone MD5 entry is read as a table. A table whose MD5 does not match, or that has a second MD5 entry, is
still read, with `md5.status` `invalid` and a limitation, because the
bootloader would refuse it. The table is located in this order:
bootloader would refuse it. Partition entries after the MD5 record are
kept. The digest covers only the entries before it, and
`entries_after_checksum` counts the later ones. The table is located in
this order:
1. at the caller's `partition_table_offset`, when given; no scan follows;
2. at the default `0x8000`;
@@ -89,7 +92,13 @@ The root `format_metadata` (`esp-flash-image`) records:
table, with its ESP image facts;
- `partition_table`: its flash address, the `method` that found it
(`default`, `caller` or `scan`), the partition count and the MD5 `status`
(`valid`, `invalid` or `absent`) with the stored and computed digests;
(`valid`, `invalid` or `absent`) with the stored and computed digests.
`entries_after_checksum`, when present, is how many partition entries
follow the MD5 record and sit outside its digest. New inventories emit
0 when the record is absent or every partition entry precedes it.
Evidence saved before the field omits it, and that omission leaves the
count unknown. When the count is greater than zero, a limitation names
it and the MD5 entry's offset from the start of the table;
- `apps`: ESP image facts for each app partition the dump holds; app
partitions declared over the same bytes share one decode;
- `otadata`: the otadata partition's records, or null without one;