diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2021-04-07 15:10:30 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2021-04-08 12:56:15 +0200 |
commit | 95656e99c2e7eacf081a0db80194b2c0c0195e33 (patch) | |
tree | aec7977eebc4e9fc4f6def3782b089602d800147 | |
parent | be75bf0b94fb4cf5638420c2eb8239fc3140855a (diff) |
openpgp: Fix Tag::arbitrary.
- Previously, we also generated Tag::Unknown(n) where n > 63.
-rw-r--r-- | openpgp/src/packet/tag.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/openpgp/src/packet/tag.rs b/openpgp/src/packet/tag.rs index 538aee92..e44956f2 100644 --- a/openpgp/src/packet/tag.rs +++ b/openpgp/src/packet/tag.rs @@ -220,7 +220,12 @@ impl fmt::Display for Tag { #[cfg(test)] impl Arbitrary for Tag { fn arbitrary<G: Gen>(g: &mut G) -> Self { - u8::arbitrary(g).into() + loop { + match u8::arbitrary(g) { + n @ 0..=63 => break n.into(), + _ => (), // try again + } + } } } |