open-standards/wai/http-conformance/falsify/depth-sum-saturates.patch
2026-10-06 10:39:19 -04:00

15 lines
741 B
Diff

# must fail: depth_out_of_bounds_bytes
# the bytes through a depth saturate (abr::depth)
diff --git a/wai/wai-rs/src/http_binding/abr.rs b/wai/wai-rs/src/http_binding/abr.rs
index 6fb8973c..42b3495d 100644
--- a/wai/wai-rs/src/http_binding/abr.rs
+++ b/wai/wai-rs/src/http_binding/abr.rs
@@ -432,7 +432,7 @@ pub fn depth(layers_n: &[u64], p: &dyn Policy, s: &AbrState) -> Result<(usize, B
let mut acc = 0u64;
st.option_bytes = Vec::with_capacity(layers_n.len());
for &n in layers_n {
- acc = acc.checked_add(n).ok_or(AbrError("the bytes through a depth pass 2^64 - 1"))?;
+ acc = acc.saturating_add(n);
st.option_bytes.push(acc);
}
st.option_joules_micro = Vec::with_capacity(layers_n.len());