#3300: import .aepx through the flat index

The .aepx reader no longer builds the owned chunk tree element by
element. It decodes every body (hex, text, alias JSON, numbers) into
one buffer and records the chunks as depth-first entries whose bodies
are ranges of that buffer; TreeIndex::from_drafts turns them into the
index the importer reads, which borrows the buffer. read_aepx converts
that index into the owned tree in one pass.

The tree and the errors are those of the previous reader, which the
tests keep as the reference: generated and damaged documents under
seven limit sets, invalid UTF-8, hostile input, the fixture directory,
and imports through both. Bound tests pin the chunk list to the input
and the limit, and check that dropped content leaves nothing behind.
This commit is contained in:
vangel76 committed 2026-11-08 18:19:12 +01:00
1 parent 5f4e7ffc18
commit a33fb4abf6
7 files changed
+1024 -122

No files matched your search

+5
View File
@@ -119,6 +119,11 @@ counterpart (a name that is not 1 to 4 characters) are skipped with their conten
with the byte offset. It runs without recursion; the nesting depth (`Limits::max_depth`) and the
element count (`Limits::max_chunks`) are bounded, and everything it allocates is bounded by the
size of the input.
- The reader decodes every body (hex, text, the alias JSON, the numbers) into one buffer and records
the chunks as a flat depth-first list whose bodies are ranges of that buffer. The importer
indexes that buffer (`TreeIndex`) as it indexes an `.aep`; `read_aepx` converts it into the
owned tree. The tree is the one the element-by-element reader gave, which the crate's tests keep
as the reference.
- Tests: `tests/aepx.rs` compares the five fixture pairs chunk by chunk and byte by byte, compares
the typed view of both forms, and runs truncated, bit-flipped, deeply nested and oversized
inputs; `crates/aep/tests/it/import/aepx.rs` imports both forms of each pair and expects the same