Skip to content

Commit 9793baa

Browse files
committed
feat: add a proper arbitrary impl for cells
1 parent f2d1f66 commit 9793baa

File tree

6 files changed

+400
-1
lines changed

6 files changed

+400
-1
lines changed

Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ members = ["proc"]
6161
[dependencies]
6262
ahash = "0.8.11"
6363
anyhow = { version = "1.0", optional = true }
64+
arbitrary = { version = "1", optional = true }
6465
base64 = { version = "0.22", optional = true }
6566
bitflags = "2.3"
6667
blake3 = { version = "1.5", optional = true }
@@ -103,6 +104,7 @@ rand = ["dep:rand"]
103104
models = ["dep:everscale-crypto", "dep:tl-proto"]
104105
blake3 = ["dep:blake3"]
105106
rayon = ["dep:rayon", "blake3?/rayon"]
107+
arbitrary = ["dep:arbitrary"]
106108
abi = [
107109
"dep:anyhow",
108110
"dep:bytes",

fuzz/Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ libfuzzer-sys = "0.4"
1313

1414
[dependencies.everscale-types]
1515
path = ".."
16-
features = ["base64"]
16+
features = ["base64", "arbitrary"]
1717

1818
# Prevent this from interfering with workspaces
1919
[workspace]
@@ -31,6 +31,12 @@ path = "fuzz_targets/boc_decode.rs"
3131
test = false
3232
doc = false
3333

34+
[[bin]]
35+
name = "boc_encode"
36+
path = "fuzz_targets/boc_encode.rs"
37+
test = false
38+
doc = false
39+
3440
[[bin]]
3541
name = "boc_decode_pair"
3642
path = "fuzz_targets/boc_decode_pair.rs"

fuzz/fuzz_targets/boc_encode.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![no_main]
2+
use libfuzzer_sys::fuzz_target;
3+
4+
use everscale_types::prelude::{Boc, Cell};
5+
6+
fuzz_target!(|cell: Cell| {
7+
_ = Boc::encode(cell);
8+
});

0 commit comments

Comments
 (0)