Skip to content

Commit

Permalink
Update fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
lrazovic authored and isislovecruft committed Feb 27, 2023
1 parent 5974664 commit 01f8d48
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 34 deletions.
15 changes: 12 additions & 3 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@

[package]
name = "subtle-fuzz"
version = "0.0.1"
authors = ["Automatically generated"]
publish = false
edition = "2018"

[package.metadata]
cargo-fuzz = true

[dependencies.subtle]
path = ".."
features = ["nightly"]
[dependencies.libfuzzer-sys]
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"

[dependencies]
libfuzzer-sys = "0.4"

# Prevent this from interfering with workspaces
[workspace]
Expand All @@ -21,15 +22,23 @@ members = ["."]
[[bin]]
name = "conditional_assign_u8"
path = "fuzzers/conditional_assign_u8.rs"
test = false
doc = false

[[bin]]
name = "conditional_assign_u16"
path = "fuzzers/conditional_assign_u16.rs"
test = false
doc = false

[[bin]]
name = "conditional_assign_i8"
path = "fuzzers/conditional_assign_i8.rs"
test = false
doc = false

[[bin]]
name = "conditional_assign_i128"
path = "fuzzers/conditional_assign_i128.rs"
test = false
doc = false
16 changes: 5 additions & 11 deletions fuzz/fuzzers/conditional_assign_i128.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#![no_main]

#[macro_use]
extern crate libfuzzer_sys;
extern crate subtle;
extern crate core;

use libfuzzer_sys::fuzz_target;
use core::intrinsics::transmute;

use subtle::ConditionallySelectable;

fuzz_target!(|data: &[u8]| {
Expand All @@ -20,10 +14,10 @@ fuzz_target!(|data: &[u8]| {
unsafe {
let mut x: i128 = 0;
let y: i128 = transmute::<[u8; 16], i128>([
bytes[0], bytes[1], bytes[2], bytes[3],
bytes[4], bytes[5], bytes[6], bytes[7],
bytes[8], bytes[9], bytes[10], bytes[11],
bytes[12], bytes[13], bytes[14], bytes[15]]);
bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7],
bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14],
bytes[15],
]);

x.conditional_assign(&y, 0.into());
assert_eq!(x, 0);
Expand Down
8 changes: 1 addition & 7 deletions fuzz/fuzzers/conditional_assign_i8.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#![no_main]

#[macro_use]
extern crate libfuzzer_sys;
extern crate subtle;
extern crate core;

use libfuzzer_sys::fuzz_target;
use core::intrinsics::transmute;

use subtle::ConditionallySelectable;

fuzz_target!(|data: &[u8]| {
Expand Down
8 changes: 1 addition & 7 deletions fuzz/fuzzers/conditional_assign_u16.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#![no_main]

#[macro_use]
extern crate libfuzzer_sys;
extern crate subtle;
extern crate core;

use libfuzzer_sys::fuzz_target;
use core::intrinsics::transmute;

use subtle::ConditionallySelectable;

fuzz_target!(|data: &[u8]| {
Expand Down
7 changes: 1 addition & 6 deletions fuzz/fuzzers/conditional_assign_u8.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#![no_main]

#[macro_use]
extern crate libfuzzer_sys;
extern crate subtle;
extern crate core;

use libfuzzer_sys::fuzz_target;
use subtle::ConditionallySelectable;

fuzz_target!(|data: &[u8]| {
Expand Down

0 comments on commit 01f8d48

Please sign in to comment.