Skip to content

Commit

Permalink
Fix fuzzer and add corpus
Browse files Browse the repository at this point in the history
Fix overflow

Remove redundant target as it is already covered by transaction target
  • Loading branch information
neithanmo committed Aug 18, 2024
1 parent 9db15d7 commit 0fb38e9
Show file tree
Hide file tree
Showing 11 changed files with 239 additions and 120 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ app/obj

app/glyphs/glyphs.*

hfuzz/hfuzz_workspace
app/hfuzz-parser/hfuzz_workspace/transaction/input/*.honggfuzz.cov


tests_zemu/snapshots-tmp
app/output/*.apdu
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ test_all:
prod:
make PRODUCTION_BUILD=1

rust_fuzz:
cd app/hfuzz-parser/ && cargo hfuzz run transaction



13 changes: 7 additions & 6 deletions app/FUZZING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ cargo install honggfuzz
Start fuzzing a desirable target:

```bash
cd hfuzz-parser && cargo hfuzz run transaction
make rust_fuzz
```

### Debugging

If there are crashes reported, debug the application with the generated input to figure out where the problem is.
The supported debuggers are: *lldb*, *rust-gdb*, *gdb*, *rust-lldb*. By default *rust-lldb* is used but,
this can be changed using the __HFUZZ_DEBUGGER__ env variable:
The supported debuggers are: _lldb_, _rust-gdb_, _gdb_, _rust-lldb_. By default _rust-lldb_ is used:

```bash
export HFUZZ_DEBUGGER="rust-gdb"
cd hfuzz-parser
HFUZZ_BUILD_ARGS="--features baking" cargo hfuzz run-debug transaction hfuzz_workspace/transaction/*.fuzz
cargo hfuzz run-debug transaction hfuzz_workspace/*/*.fuzz

```

*note*: There could be more than one *.fuzz* file.
This will deploy a gdb console with a backtrace with the first crash

_note_: There could be more than one _.fuzz_ file.
Loading

0 comments on commit 0fb38e9

Please sign in to comment.