Extend fuzzing to semantic analysis and codegen
* Fix a panic when we are substituting macro args, but we already had an error involving the macro. * Fix a stack overflow when an internal extractor's definition is recursive.
This commit is contained in:
committed by
Chris Fallin
parent
9be1942b11
commit
a099b2b590
@@ -7,9 +7,26 @@ fuzz_target!(|s: &str| {
|
||||
|
||||
let lexer = isle::lexer::Lexer::from_str(s, "fuzz-input.isle");
|
||||
log::debug!("lexer = {:?}", lexer);
|
||||
let lexer = match lexer {
|
||||
Ok(l) => l,
|
||||
Err(_) => return,
|
||||
};
|
||||
|
||||
if let Ok(lexer) = lexer {
|
||||
let defs = isle::parser::parse(lexer);
|
||||
log::debug!("defs = {:?}", defs);
|
||||
}
|
||||
let defs = isle::parser::parse(lexer);
|
||||
log::debug!("defs = {:?}", defs);
|
||||
let defs = match defs {
|
||||
Ok(d) => d,
|
||||
Err(_) => return,
|
||||
};
|
||||
|
||||
let code = isle::compile::compile(&defs);
|
||||
log::debug!("code = {:?}", code);
|
||||
let code = match code {
|
||||
Ok(c) => c,
|
||||
Err(_) => return,
|
||||
};
|
||||
|
||||
// TODO: check that the generated code is valid Rust. This will require
|
||||
// stubbing out extern types, extractors, and constructors.
|
||||
drop(code);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user