Add a simple fuzz-testing harness for the sql parser (#1864)

This commit is contained in:
Nathaniel Brough 2023-04-25 15:35:39 -07:00 committed by GitHub
parent b3ebd4c6b5
commit f04f575283
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 2413 additions and 0 deletions

4
lib/fuzz/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
target
corpus
artifacts
coverage

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
View 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

View file

@ -0,0 +1,8 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &str| {
// Don't crash.
_ = surrealdb::sql::parse(data);
});