summaryrefslogtreecommitdiffstats
path: root/openpgp/src/packet/tag.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/packet/tag.rs')
-rw-r--r--openpgp/src/packet/tag.rs7
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
+ }
+ }
}
}