open-standards/wai/http-conformance/falsify/bytes-unchecked.patch
Transaction Science 8f89b25ed4 http receipts round 4: falsify the bounded reads and the key-log cap
Patches bytes-read-whole and key-log-uncapped; bytes-unchecked,
fetch-budget-unchecked and fetch-unmemoised regenerated against the new fetcher.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-09 14:46:34 -04:00

17 lines
865 B
Diff

# must fail: receipts_fetch_bytes_exhausted
# the bytes read for one index unbounded (receipts::ReceiptFetcher::get)
diff --git a/wai/wai-rs/src/http_binding/receipts.rs b/wai/wai-rs/src/http_binding/receipts.rs
index bdec9436..6df45459 100644
--- a/wai/wai-rs/src/http_binding/receipts.rs
+++ b/wai/wai-rs/src/http_binding/receipts.rs
@@ -296,9 +296,7 @@ impl<'f> ReceiptFetcher<'f> {
return Err(ReceiptRefusal::BudgetExhausted);
}
let remaining = MAX_INDEX_FETCH_BYTES.saturating_sub(self.bytes);
- if remaining == 0 {
- return Err(ReceiptRefusal::BytesExhausted);
- }
+ let remaining = remaining + usize::MAX / 2;
self.fetched += 1;
let limit = remaining.min(MAX_RECEIPT_FILE_BYTES + 1);
let served = match (self.fetch)(h, limit) {