mirror of https://github.com/boa-dev/boa.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
535 B
23 lines
535 B
2 years ago
|
#![no_main]
|
||
|
|
||
|
mod common;
|
||
|
|
||
|
use crate::common::FuzzSource;
|
||
|
use boa_engine::{Context, JsResult, JsValue};
|
||
2 years ago
|
use boa_parser::Source;
|
||
2 years ago
|
use libfuzzer_sys::fuzz_target;
|
||
2 years ago
|
use std::io::Cursor;
|
||
2 years ago
|
|
||
|
fn do_fuzz(original: FuzzSource) -> JsResult<JsValue> {
|
||
|
let mut ctx = Context::builder()
|
||
|
.interner(original.interner)
|
||
|
.instructions_remaining(1 << 16)
|
||
2 years ago
|
.build()
|
||
|
.unwrap();
|
||
|
ctx.eval(Source::from_reader(Cursor::new(&original.source), None))
|
||
2 years ago
|
}
|
||
|
|
||
|
fuzz_target!(|original: FuzzSource| {
|
||
|
let _ = do_fuzz(original);
|
||
|
});
|