diff --git a/fuzz/atom/parser/fuzz.rs b/fuzz/atom/parser/fuzz.rs index 83d5787..b3539d6 100644 --- a/fuzz/atom/parser/fuzz.rs +++ b/fuzz/atom/parser/fuzz.rs @@ -3,26 +3,10 @@ use core::slice; use gentoo_utils::{Parseable, atom::Atom}; -use std::{ - io::{self, Write}, - sync::{LazyLock, Mutex}, -}; - -#[derive(Debug)] -struct State { - input: io::Stdin, - output: io::Stdout, -} +use std::io::{self, Write}; #[unsafe(no_mangle)] pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) -> i32 { - static PIPES: LazyLock> = LazyLock::new(|| { - Mutex::new(State { - input: io::stdin(), - output: io::stdout(), - }) - }); - let slice = unsafe { slice::from_raw_parts(input, len) }; let str = str::from_utf8(slice).expect("expected ascii input"); @@ -30,13 +14,13 @@ pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) -> return -1; } - let mut state = PIPES.lock().unwrap(); - - writeln!(&mut state.output, "{str}").unwrap(); - + let stdin = io::stdin(); + let mut stdout = io::stdout(); let mut buffer = String::new(); - state.input.read_line(&mut buffer).unwrap(); + writeln!(&mut stdout, "{str}").unwrap(); + + stdin.read_line(&mut buffer).unwrap(); let control = match buffer.as_str().trim() { "0" => Ok(()),