From 4d10ca018f281e70cbf3eefda515031383248379 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Thu, 19 Nov 2026 00:37:13 -0500 Subject: [PATCH] docs(parsers): explain encoded bounds and limit reporting --- docs/development/tool-design.md | 8 +++++++- docs/rust-binaries.md | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/development/tool-design.md b/docs/development/tool-design.md index 67deded94e..773d3a4687 100644 --- a/docs/development/tool-design.md +++ b/docs/development/tool-design.md @@ -278,6 +278,9 @@ normalized lookup value. Verify both operations with the same authored inputs and independently specified expectations. See [boundary regressions](testing.md#boundary-regressions). Give each nested parser the admitted extent of its containing record. +Check a child's declared encoded range against that extent before applying +its decoding allowance. When the range cannot fit, report the format failure +even if the declared decoded size would also exceed a budget. Retain the source offset and the reason when a field is malformed or its encoding is unsupported. A stream may need more bytes to complete a frame. A completed artifact with the same missing bytes has truncated data. Carry @@ -345,7 +348,10 @@ A byte-format parser reports failure with `ParseFailureError` from fields through `BinaryReader` (`src/domain/binaryContainer.ts`), which raises that failure instead of a bare `RangeError`. Providers project the failure with `parseFailureAnalysisError` rather than their own `instanceof` -ladder; a `limit` stays with its producer, which knows the budget to name. +ladder. The producing reader identifies the named limit and effective maximum. +Use those facts for the public refusal and recovery. When decoding stops before +the reader can measure the final allowance, report the bound that actually +stopped it. For retained managed metadata rows, use `metadataRowCursor` in `src/domain/managed/managedMetadataHeaps.ts`. Its column reads use diff --git a/docs/rust-binaries.md b/docs/rust-binaries.md index bf6e9e6bce..71385237e5 100644 --- a/docs/rust-binaries.md +++ b/docs/rust-binaries.md @@ -251,3 +251,8 @@ Graph expansion and compiler-path retention consume the same selected report allowance. The independent compressed dependency limit (1 MiB), inflated JSON limits (8 MiB and 64 times the consumed stream), parser nesting and transport budgets remain enforced; increasing report admission does not raise those. +When PE file alignment adds padding, the reader learns the exact consumed +stream length only after inflation completes. If inflation stops first, +`reported_limits.maximum_bytes` gives the allocation ceiling in force, the +smaller of 8 MiB and 64 times the stored extent. If inflation completes, the +ratio check uses the consumed stream length.