diff options
| author | Leonardo Guimaraes <leozinhoszg@gmail.com> | 2026-11-22 12:30:26 -0300 |
|---|---|---|
| committer | Leonardo Guimaraes <leozinhoszg@gmail.com> | 2026-11-22 12:30:26 -0300 |
| commit | 5d4285f383ae32c077b7667056442ef16d2540c1 (patch) | |
| tree | bb3daab0e48110aab7603ca0ef02860a53b99084 /runtime/src/pe_loader.cpp | |
| parent | 4eb6155d3ac4f9d3fadb0d095c4ce13e76783615 (diff) | |
rbf0_encode: write an rbf0_tree document back to bytes, with a round-trip check
docs/rbf0.md called the tree output "a rendering, not a round-trip" and
nothing wrote RBF0. encode(doc) rebuilds the record stream from the tree
rbf0_tree.parse_resource returns, in both layouts: descriptor names at
first use, element words 0, 0, attribute count, attributes then content
in tree order, text and strings with their recorded NUL.
It fails closed, with a reason, when the tree cannot hold the original:
an incomplete parse, invalid UTF-8 the decoder replaced, a NaN float
(infinities are exact), an attribute after content, a descriptor out of
order, or a string or text whose byte length changed.
--check decodes, encodes and compares every resource of a carve and
prints counts only. A report-and-directory form writes the resources of
an rbf0_tree.py JSON report (possibly edited) as .rbf files.
Measured on the 1,263 data.rpf resources: 1,240 byte-identical, 0
different, 23 refused, all for invalid UTF-8. They are the resources
holding the 26 invalid payloads docs/rbf0.md already lists. Counts are
in docs/rbf0.md 9.6.
tests/test_rbf0_encode.py: synthetic streams only. Every record type in
both widths, infinities, narrow float bits, the largest integers, the
JSON report form, an edited tree, each refusal reason, and the CLI with
a resource split over two 64 KiB streams.
Diffstat (limited to 'runtime/src/pe_loader.cpp')
0 files changed, 0 insertions, 0 deletions