mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-26 17:31:05 +01:00
Add fuzzing support
This commit is contained in:
1 parent
1f5008f673
commit
de3024f6b2
4 files changed
+51
No files matched your search
@@ -0,0 +1,3 @@
|
||||
target
|
||||
corpus
|
||||
artifacts
|
||||
@@ -0,0 +1,32 @@
|
||||
[package]
|
||||
name = "naga-fuzz"
|
||||
version = "0.0.0"
|
||||
authors = ["Automatically generated"]
|
||||
publish = false
|
||||
edition = "2018"
|
||||
|
||||
[package.metadata]
|
||||
cargo-fuzz = true
|
||||
|
||||
[dependencies]
|
||||
libfuzzer-sys = "0.3"
|
||||
|
||||
[dependencies.naga]
|
||||
path = ".."
|
||||
features = ["spirv"]
|
||||
|
||||
# Prevent this from interfering with workspaces
|
||||
[workspace]
|
||||
members = ["."]
|
||||
|
||||
[[bin]]
|
||||
name = "spv_parser"
|
||||
path = "fuzz_targets/spv_parser.rs"
|
||||
test = false
|
||||
doc = false
|
||||
|
||||
[[bin]]
|
||||
name = "wgsl_parser"
|
||||
path = "fuzz_targets/wgsl_parser.rs"
|
||||
test = false
|
||||
doc = false
|
||||
@@ -0,0 +1,8 @@
|
||||
#![no_main]
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use naga::front::spv::Parser;
|
||||
|
||||
fuzz_target!(|data: Vec<u32>| {
|
||||
// Ensure the parser can handle potentially malformed data without crashing.
|
||||
let _result = Parser::new(data.into_iter()).parse();
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
#![no_main]
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use naga::front::wgsl::Parser;
|
||||
|
||||
fuzz_target!(|data: String| {
|
||||
// Ensure the parser can handle potentially malformed strings without crashing.
|
||||
let _result = Parser::new().parse(&data);
|
||||
});
|
||||
Reference in new issue
Block a user