From 88a7252e33c32ce33858b29202eb799a923de17d Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Fri, 24 Apr 2026 00:08:22 +0200 Subject: [PATCH] oid: Fix `impl Arbitrary for Oid` `fill` would cause the OID to consist of 20 repetitions of the same byte every time, not an arbitrary OID. --- crates/radicle-oid/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/radicle-oid/src/lib.rs b/crates/radicle-oid/src/lib.rs index bd42f10d..e44b91a9 100644 --- a/crates/radicle-oid/src/lib.rs +++ b/crates/radicle-oid/src/lib.rs @@ -469,9 +469,7 @@ mod test { impl Arbitrary for Oid { fn arbitrary(g: &mut Gen) -> Self { - let slice = [0u8; Oid::SHA1_LEN]; - g.fill(slice); - Self::Sha1(slice) + Self::Sha1(<[u8; Oid::LEN_SHA1]>::arbitrary(g)) } } }