Skip to content

Commit

Permalink
Fix fuzzing script trimming.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Dec 20, 2023
1 parent 5fdabb4 commit 374a7e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fuzz/fuzz_targets/scripting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ fuzz_target!(|ctx: Ctx| {
engine.set_optimization_level(ctx.optimization_level);

// Limit the length of scripts.
let script = &ctx.script[..(ctx.script.len().min(32 * 1020))];
let script = ctx.script.chars().take(32 * 1024).collect::<String>();

// We need fuzzing to be fast, so we'll stop executing after 1s.
let start = Instant::now();
engine.on_progress(move |_| (start.elapsed().as_millis() > 1000).then_some(Dynamic::UNIT));

let engine = engine;

_ = engine.run(script);
_ = engine.run(&script);
});

0 comments on commit 374a7e2

Please sign in to comment.