From b0d68ad3b99aa06029f30d7dc45455108b52dadc Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 15 Nov 2026 16:31:47 +0000 Subject: api: a signed write after the last seq there is a conflict, not a panic `put_signed` added one to the `seq` of the envelope there unchecked: at `u64::MAX` it panicked where overflow is checked and wrapped where it isn't. It adds as `envelope::check` does, and nothing follows `u64::MAX`: `409`, as for any write not numbered after what is there. --- src/api/store.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/store.rs b/src/api/store.rs index f0b3094..3ecba58 100644 --- a/src/api/store.rs +++ b/src/api/store.rs @@ -569,7 +569,7 @@ async fn put_signed( let signed = envelope::read(&sealed).map_err(bad)?; let next = previous .as_deref() - .map_or(Some(0), |before| Some(envelope::seq(before)? + 1)); + .map_or(Some(0), |before| envelope::seq(before)?.checked_add(1)); if signed.prev != envelope::digest(previous.as_deref()) || Some(signed.seq) != next { return Err(ApiError( StatusCode::CONFLICT, -- cgit v1.3.1