open-standards/wai/http-conformance/falsify/index-size-unchecked.patch
Transaction Science 71cb8cbed9 http receipts: falsify the round-2 fixes
Patches (falsify/run.sh) for each fix, each failing the corpus cases it names:
legacy-group-read, walk-unclamped, fetch-unmemoised, fetch-budget-unchecked,
file-cap-unchecked, index-size-unchecked, index-items-uncapped,
index-claims-uncapped, claim-through-any-receipt, ancestor-unrecovered,
step6-skipped, figure-not-held-accepted, energy-context-assumed,
gap-coordinates-unchecked; ancestor-as-object, claim-parent-unfetched,
rcpt-name-unchecked, walk-skipped and walk-unbounded regenerated against the new
receipts.rs. Python mutations groups-from-listed, budget-unchecked and
caps-unchecked added, and the round's legacy-admitted, memo-off, walk-unclamped,
step6-skipped and ancestor-any listed in run.sh in place of ancestor-as-object.

The CLI's stream server now outlasts the deadline, so a client without the index
cap reports the deadline instead; the wall-clock assertion is dropped (the
deadline's own report is what the test reads).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-07 22:30:00 -04:00

15 lines
842 B
Diff

# must fail: receipts_index_too_large
# an index over 4 MiB read (receipts::ReceiptIndex::from_bytes)
diff --git a/wai/wai-rs/src/http_binding/receipts.rs b/wai/wai-rs/src/http_binding/receipts.rs
index f2bdba57..0562284b 100644
--- a/wai/wai-rs/src/http_binding/receipts.rs
+++ b/wai/wai-rs/src/http_binding/receipts.rs
@@ -298,7 +298,7 @@ impl ReceiptIndex {
/// reading's reason). Each claim entry is a link hash (`receipt_index_malformed`). An
/// item that does not read is kept as its refusal.
pub fn from_bytes(bytes: &[u8]) -> Result<ReceiptIndex, ReceiptRefusal> {
- if bytes.len() > MAX_INDEX_BYTES {
+ if bytes.len() > usize::MAX - MAX_INDEX_BYTES {
return Err(ReceiptRefusal::IndexTooLarge("more bytes than a client reads"));
}
let bad = ReceiptRefusal::IndexMalformed;