-
Notifications
You must be signed in to change notification settings - Fork 113
add AFL++ IJON functionality #655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
b250190
add AFL++ IJON functionality
vanhauser-thc d2ab3bd
example
vanhauser-thc 94ab7cb
fix ijon macros
vanhauser-thc 2ea0d2d
add ijon pass
vanhauser-thc 021ed32
add test
vanhauser-thc 729399d
Verify that plugins are available in `integration_maze` test
smoelius 7e60ee1
znostart-stop-gc
vanhauser-thc d1f00bb
update afl++
vanhauser-thc bc683c6
clippy
vanhauser-thc 86d8d2a
fmt
vanhauser-thc 6e50d3a
clippy, cfg fuzzing, docs
vanhauser-thc fb9386d
clippy
vanhauser-thc c1da0bb
Update README.md
vanhauser-thc b55aa77
Update README.md
vanhauser-thc 90ebb05
Update README.md
vanhauser-thc 887cd59
Update README.md
vanhauser-thc 08ce698
Update afl/examples/maze.rs
vanhauser-thc bd0db01
Update afl/examples/maze.rs
vanhauser-thc 0e10bf6
Update afl/examples/maze.rs
vanhauser-thc c83393d
Update afl/examples/maze.rs
vanhauser-thc ad9e947
Update afl/src/lib.rs
vanhauser-thc 6c7de49
Update afl/src/lib.rs
vanhauser-thc 8777f4e
Update cargo-afl/tests/integration.rs
vanhauser-thc a770ae6
Update README.md
vanhauser-thc a214ea6
nits
vanhauser-thc 0950ec9
nits
vanhauser-thc 65db9f2
clippy
vanhauser-thc 5587586
fix
vanhauser-thc 23ab3dd
fix
vanhauser-thc 64b7a8e
use afl::
vanhauser-thc 6ef12b5
try maze 3 times for integration
vanhauser-thc ccb9745
clippy
vanhauser-thc ccc4b5c
clippy
vanhauser-thc 4b29e67
Update cargo-afl/tests/integration.rs
vanhauser-thc ad1842c
indent
vanhauser-thc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
/* | ||
The maze: | ||
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], | ||
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1], | ||
[1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1], | ||
[1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1], | ||
[1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1], | ||
[1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1], | ||
[1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1], | ||
[1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1], | ||
[1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1], | ||
[1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1], | ||
[1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1], | ||
[1,0,1,0,1,0,1,0,1,0,1,0,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,1,1,1,0,1,0,1,0,1], | ||
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1], | ||
[1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1], | ||
[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1], | ||
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], | ||
*/ | ||
|
||
vanhauser-thc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/* Solution: | ||
cddbddcccacaaaccaaaaaabbbbbbbbbbaaccccccccccccaaccaabbbbbbbbbbbbbbbbbbbbbbbbbaacccccccccccccccccccccccccccccdddddddddddddddddddddddddddddbbbbbbbbbbbbbbbd | ||
*/ | ||
|
||
#![allow( | ||
clippy::too_many_lines, | ||
clippy::manual_assert, | ||
clippy::cast_possible_truncation | ||
)] | ||
vanhauser-thc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
#[cfg(fuzzing)] | ||
use afl::ijon_hashint; | ||
#[cfg(fuzzing)] | ||
use afl::ijon_hashstr; | ||
#[cfg(fuzzing)] | ||
use afl::ijon_set; | ||
#[cfg(fuzzing)] | ||
use std::ffi::CString; | ||
vanhauser-thc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
fn main() { | ||
afl::fuzz!(|data: &[u8]| { | ||
// 31x31 maze, 0 = open, 1 = wall, 2 = start, 3 = exit | ||
|
||
let maze = [ | ||
[ | ||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
1, 1, 1, | ||
], | ||
[ | ||
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, | ||
0, 0, 1, | ||
], | ||
[ | ||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
1, 1, 1, | ||
], | ||
]; | ||
vanhauser-thc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
let mut pos: (usize, usize) = (15, 15); // start position | ||
|
||
for &b in data { | ||
let next = match b % 4 { | ||
0 => (pos.0.wrapping_sub(1), pos.1), // up | ||
1 => (pos.0 + 1, pos.1), // down | ||
2 => (pos.0, pos.1.wrapping_sub(1)), // left | ||
_ => (pos.0, pos.1 + 1), // right | ||
}; | ||
|
||
if next.0 < 31 && next.1 < 31 && maze[next.0][next.1] != 1 { | ||
pos = next; | ||
} | ||
|
||
if maze[pos.0][pos.1] == 3 { | ||
panic!("Exited the maze!"); | ||
} | ||
|
||
#[cfg(fuzzing)] | ||
ijon_set!(ijon_hashint(pos.0 as u32, pos.1 as u32)); | ||
} | ||
}); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.