بنقرة واحدة
fuzz
Fuzz SQL parser and storage with cargo-fuzz — setup targets, run, add regression tests for crashes
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Fuzz SQL parser and storage with cargo-fuzz — setup targets, run, add regression tests for crashes
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Verify and fix documented gaps one at a time — reproduce, root cause, minimal fix, wire-test regression, close
Discover undocumented gaps by comparing AxiomDB against MySQL/PostgreSQL — build inventory, run tests, classify, hand off to hunt-gap
Run Criterion micro-benchmarks and 3-Docker comparison benchmarks, verify no regression against MySQL/PostgreSQL
Explore approaches before proposing — read context, ask questions, present 2+ options with trade-offs, write sprint with dependencies
Save session context to a checkpoint file so the next session can resume without losing state
Systematic debug protocol — reproduce with minimal test, 2+ hypotheses, fix root cause, add regression test
| name | fuzz |
| description | Fuzz SQL parser and storage with cargo-fuzz — setup targets, run, add regression tests for crashes |
Critical for the SQL parser (malformed inputs) and storage (corrupt pages).
# Install cargo-fuzz
cargo install cargo-fuzz
# Create fuzz targets
cd /home/familia/axiomdb
cargo fuzz init # if first time
# Targets for axiomdb
cargo fuzz add fuzz_sql_parser # parse random SQL
cargo fuzz add fuzz_storage_pages # pages with corrupt bytes
cargo fuzz add fuzz_wal_recovery # truncated or corrupt WAL
cargo fuzz add fuzz_btree_ops # operations on the B+ Tree
// fuzz/fuzz_targets/fuzz_sql_parser.rs
#![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
if let Ok(sql) = std::str::from_utf8(data) {
// The parser must NEVER panic with arbitrary input
// It can only return Ok or Err — never panic/crash
let _ = axiomdb_sql::Parser::new().parse(sql);
}
});
// fuzz/fuzz_targets/fuzz_storage_pages.rs
fuzz_target!(|data: &[u8]| {
if data.len() < 8192 { return; }
let mut page_bytes = [0u8; 8192];
page_bytes.copy_from_slice(&data[..8192]);
// The storage must NEVER panic reading a corrupt page
let _ = axiomdb_storage::Page::from_bytes(&page_bytes);
});
# Run a target (Ctrl+C to stop)
cargo fuzz run fuzz_sql_parser
# With timeout
cargo fuzz run fuzz_sql_parser -- -max_total_time=300 # 5 minutes
# View code coverage
cargo fuzz coverage fuzz_sql_parser
cargo fuzz fmt coverage fuzz_sql_parser
# View crashes found
ls fuzz/artifacts/fuzz_sql_parser/
# Reproduce the crash
cargo fuzz run fuzz_sql_parser fuzz/artifacts/fuzz_sql_parser/crash-HASH
# Minimize the input (find the minimum that reproduces the crash)
cargo fuzz tmin fuzz_sql_parser fuzz/artifacts/fuzz_sql_parser/crash-HASH
// Add as a permanent regression test
#[test]
fn test_fuzz_regression_sql_crash_20260321() {
// Input that caused a crash in fuzz testing (2026-03-21)
// Cause: the parser did not handle invalid UTF-8 in table name
let input = b"\xff\xfe SELECT * FROM";
let result = Parser::new().parse(std::str::from_utf8(input).unwrap_or(""));
// Must return Err, never panic
assert!(result.is_err() || result.is_ok()); // must not reach here if there was a panic
}
# .github/workflows/fuzz.yml
- name: Fuzz SQL Parser (60s)
run: cargo fuzz run fuzz_sql_parser -- -max_total_time=60
- name: Fuzz Storage (60s)
run: cargo fuzz run fuzz_storage_pages -- -max_total_time=60