forked from gentoo-utils/gentoo-utils
check if fuzz input is graphical before decoding it to UTF8
This commit is contained in:
@@ -37,15 +37,15 @@ pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) ->
|
||||
|
||||
let slice = unsafe { slice::from_raw_parts(input, len) };
|
||||
|
||||
if slice.iter().any(|b| !b.is_ascii_graphic()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
let str = match str::from_utf8(slice) {
|
||||
Ok(str) => str,
|
||||
Err(_) => return -1,
|
||||
};
|
||||
|
||||
if !str.chars().all(|c| c.is_ascii_graphic()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
let atom = str.trim();
|
||||
|
||||
let mut stdin = PY_PROCESS.stdin.lock().expect("failed to get stdin lock");
|
||||
|
||||
Reference in New Issue
Block a user