Skip to content

Commit

Permalink
more harness
Browse files Browse the repository at this point in the history
  • Loading branch information
Parsa-JF committed Jun 3, 2023
1 parent 536237f commit 89dde57
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/mayhem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ jobs:
fail-fast: false
matrix:
mayhemfile:
- mayhem/Mayhemfile
- mayhem/user.Mayhemfile
- mayhem/group.Mayhemfile

steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 6 additions & 2 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ honggfuzz = "0.5.55"
members = ["."]

[[bin]]
name = "target"
path = "fuzz_targets/target.rs"
name = "group_to_gid"
path = "fuzz_targets/group_to_gid.rs"

[[bin]]
name = "user_to_uid"
path = "fuzz_targets/user_to_uid.rs"
17 changes: 17 additions & 0 deletions fuzz/fuzz_targets/group_to_gid.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use honggfuzz::fuzz;
use rppal::pwm::sysfs::user_to_uid;

fn main() {
// Define the fuzzing loop
loop {
// Fuzzing input will be provided by Honggfuzz
fuzz!(|data: &[u8]| {
// Convert the input to a string
if let Ok(name) = std::str::from_utf8(data) {
// Call the user_to_uid function with the fuzzed input
let _ = group_to_gid(name);

}
});
}
}
File renamed without changes.
3 changes: 2 additions & 1 deletion mayhem/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ RUN cd ./fuzz && cargo +nightly hfuzz build
# Move Fuzzers to a clean image
FROM ubuntu:20.04

COPY --from=builder rppal/fuzz/hfuzz_target/x86_64-unknown-linux-gnu/release/target /
COPY --from=builder rppal/fuzz/hfuzz_target/x86_64-unknown-linux-gnu/release/user_to_uid /
COPY --from=builder rppal/fuzz/hfuzz_target/x86_64-unknown-linux-gnu/release/group_to_gid /
5 changes: 0 additions & 5 deletions mayhem/Mayhemfile

This file was deleted.

5 changes: 5 additions & 0 deletions mayhem/group.Mayhemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
project: rppal
group_to_gid: group_to_gid

cmds:
- cmd: /group_to_gid
5 changes: 5 additions & 0 deletions mayhem/user.Mayhemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
project: rppal
user_to_uid: user_to_uid

cmds:
- cmd: /user_to_uid

0 comments on commit 89dde57

Please sign in to comment.