You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#46 added some utilities to handle stdin and panics. Here's a different design I was thinking about:
structInput(io::Stdin);implInput{pubfninto_bytes() -> Vec<u8>{unimplemented!()}pubfninto_string() -> Option<String>{letmut input = String::new();let result = io::stdin().read_to_string(&mut input);match result {Ok(_) => Some(input),Err(_) => None,}}}implReadforInput{
...
}pubfnhandle<F>(closure:F)whereF:FnOnce(Input) + UnwindSafe{let input = Input(io::stdin());let result = panic::catch_unwind(|| {closure(input);});if result.is_err(){unsafe{abort();}}}
instead of handle_* functions, just one handle function with one input type: Input. The downsides of this design though is that a user might want a string and to input.into_string().unwrap() which will cause a panic sometimes which will result in a crash for AFL.
The text was updated successfully, but these errors were encountered:
}
pub fn into_string() -> Option<String> {
let mut input = String::new();
let result = io::stdin().read_to_string(&mut input);
match result {
Ok(_) => Some(input),
Err(_) => None,
}
}
}
pub fn new_handle(closure: F)
where F: FnOnce(Input) + UnwindSafe
{
let input = Input(io::stdin());
let result = panic::catch_unwind(|| {
closure(input);
});
if result.is_err() {
// TODO: add option to prevent this abort?
unsafe {
abort();
}
}
}
instead of handle_* functions, just one handle function with one input
type: Input. The downsides of this design though is that a user might
want a string and to input.into_string().unwrap() which will cause a
panic sometimes which will result in a crash for AFL.
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: D1B3 ADC0 E023 8CA6
#46 added some utilities to handle stdin and panics. Here's a different design I was thinking about:
instead of
handle_*
functions, just onehandle
function with one input type:Input
. The downsides of this design though is that a user might want a string and toinput.into_string().unwrap()
which will cause a panic sometimes which will result in a crash for AFL.The text was updated successfully, but these errors were encountered: