Add fuzzing

Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
Marcel Müller 2026-03-09 15:20:02 +01:00
parent e0e84ede1c
commit fa1582f3ad
6 changed files with 327 additions and 0 deletions

View file

@ -0,0 +1,18 @@
#![no_main]
use libfuzzer_sys::Corpus;
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: String| -> Corpus {
let Ok(parsed) = nomo::parser::parse(data.into()) else {
return Corpus::Reject;
};
let Ok(ast) = nomo::ast::parse(parsed.tokens()) else {
return Corpus::Keep;
};
let _instructions = nomo::emit::emit_machine(ast);
Corpus::Keep
});