Skip to content

Commit

Permalink
Add some Arbitrary impls to support cargo-fuzz based fuzz testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ximon18 committed Nov 6, 2024
1 parent c0fc11b commit bdeddde
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ name = "domain"
path = "src/lib.rs"

[dependencies]
arbitrary = { version = "1.4.1", optional = true, features = ["derive"] }
octseq = { version = "0.5.2", default-features = false }
time = { version = "0.3.1", default-features = false }
rand = { version = "0.8", optional = true }
Expand Down
1 change: 1 addition & 0 deletions src/base/iana/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ macro_rules! int_enum {
$value:expr, $mnemonic:expr) )* ) => {
$(#[$attr])*
#[derive(Clone, Copy, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct $ianatype($inttype);

impl $ianatype {
Expand Down
1 change: 1 addition & 0 deletions src/base/name/absolute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ use std::vec::Vec;
/// [`Display`]: std::fmt::Display
#[derive(Clone)]
#[repr(transparent)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct Name<Octs: ?Sized>(Octs);

impl Name<()> {
Expand Down
1 change: 1 addition & 0 deletions src/rdata/nsec3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ impl<Octs: AsRef<[u8]>> ZonefileFmt for Nsec3param<Octs> {
/// no whitespace allowed.
#[derive(Clone)]
#[repr(transparent)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct Nsec3Salt<Octs: ?Sized>(Octs);

impl Nsec3Salt<()> {
Expand Down

0 comments on commit bdeddde

Please sign in to comment.