-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
2,020 additions
and
148 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,43 @@ | ||
/* | ||
Run with libFuzzer: | ||
```sh | ||
cargo fuzz run --release --features libfuzzer mtl | ||
``` | ||
Run with AFL++: | ||
```sh | ||
cd fuzz | ||
cargo afl build --release --features afl | ||
cargo afl fuzz -i seeds/mtl -o out target/release/mtl | ||
``` | ||
*/ | ||
|
||
#![cfg_attr(feature = "libfuzzer", no_main)] | ||
|
||
use std::collections::HashMap; | ||
|
||
use mesh_loader::obj::read_mtl; | ||
|
||
#[cfg(any( | ||
not(any(feature = "libfuzzer", feature = "afl")), | ||
all(feature = "libfuzzer", feature = "afl"), | ||
))] | ||
compile_error!("exactly one of 'libfuzzer' or 'afl' feature must be enabled"); | ||
|
||
#[cfg(feature = "libfuzzer")] | ||
libfuzzer_sys::fuzz_target!(|bytes: &[u8]| { | ||
run(bytes); | ||
}); | ||
|
||
#[cfg(feature = "afl")] | ||
fn main() { | ||
afl::fuzz!(|bytes: &[u8]| { | ||
run(bytes); | ||
}); | ||
} | ||
|
||
fn run(bytes: &[u8]) { | ||
let _result = read_mtl(bytes, None, &mut vec![], &mut HashMap::new()); | ||
} |
This file contains 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,41 @@ | ||
/* | ||
Run with libFuzzer: | ||
```sh | ||
cargo fuzz run --release --features libfuzzer obj | ||
``` | ||
Run with AFL++: | ||
```sh | ||
cd fuzz | ||
cargo afl build --release --features afl | ||
cargo afl fuzz -i seeds/obj -o out target/release/obj | ||
``` | ||
*/ | ||
|
||
#![cfg_attr(feature = "libfuzzer", no_main)] | ||
|
||
use mesh_loader::obj::from_slice; | ||
|
||
#[cfg(any( | ||
not(any(feature = "libfuzzer", feature = "afl")), | ||
all(feature = "libfuzzer", feature = "afl"), | ||
))] | ||
compile_error!("exactly one of 'libfuzzer' or 'afl' feature must be enabled"); | ||
|
||
#[cfg(feature = "libfuzzer")] | ||
libfuzzer_sys::fuzz_target!(|bytes: &[u8]| { | ||
run(bytes); | ||
}); | ||
|
||
#[cfg(feature = "afl")] | ||
fn main() { | ||
afl::fuzz!(|bytes: &[u8]| { | ||
run(bytes); | ||
}); | ||
} | ||
|
||
fn run(bytes: &[u8]) { | ||
let _result = from_slice::<Vec<u8>, _>(bytes, None, |_| panic!()); | ||
} |
This file contains 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,9 @@ | ||
# | ||
newmtl name | ||
Ka 0.1 0.2 1.0 | ||
Kd 0.9 0.8 0.0 | ||
Ks 0.3 0.5 0.7 | ||
d 1.0 | ||
Ns 0.0 | ||
illum 2 | ||
map_Kd .\texture.jpg |
This file contains 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,13 @@ | ||
# | ||
mtllib usemtl.mtl | ||
|
||
g group | ||
|
||
v 0.0 -0.0 1.0 | ||
|
||
vt -0.1 0.5 -1.0 | ||
|
||
vn 1.0 0.0 -0.6 | ||
|
||
usemtl mtl | ||
f 1/1/1 1/1/1 1/1/1 |
This file contains 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 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
Oops, something went wrong.