Add a simple fuzz-testing harness for the sql parser (#1864)
This commit is contained in:
parent
b3ebd4c6b5
commit
f04f575283
4 changed files with 2413 additions and 0 deletions
4
lib/fuzz/.gitignore
vendored
Normal file
4
lib/fuzz/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
target
|
||||
corpus
|
||||
artifacts
|
||||
coverage
|
2373
lib/fuzz/Cargo.lock
generated
Normal file
2373
lib/fuzz/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
28
lib/fuzz/Cargo.toml
Normal file
28
lib/fuzz/Cargo.toml
Normal file
|
@ -0,0 +1,28 @@
|
|||
[package]
|
||||
name = "surrealdb-fuzz"
|
||||
version = "0.0.0"
|
||||
publish = false
|
||||
edition = "2021"
|
||||
|
||||
[package.metadata]
|
||||
cargo-fuzz = true
|
||||
|
||||
[dependencies]
|
||||
libfuzzer-sys = { version= "0.4", features = ["arbitrary-derive"] }
|
||||
arbitrary = { version = "1", features = ["derive"] }
|
||||
|
||||
[dependencies.surrealdb]
|
||||
path = ".."
|
||||
|
||||
# Prevent this from interfering with workspaces
|
||||
[workspace]
|
||||
members = ["."]
|
||||
|
||||
[profile.release]
|
||||
debug = 1
|
||||
|
||||
[[bin]]
|
||||
name = "fuzz_sql_parser"
|
||||
path = "fuzz_targets/fuzz_sql_parser.rs"
|
||||
test = false
|
||||
doc = false
|
8
lib/fuzz/fuzz_targets/fuzz_sql_parser.rs
Normal file
8
lib/fuzz/fuzz_targets/fuzz_sql_parser.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|data: &str| {
|
||||
// Don't crash.
|
||||
_ = surrealdb::sql::parse(data);
|
||||
});
|
Loading…
Reference in a new issue