summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fuzz/fuzz.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/fuzz/fuzz.rs b/fuzz/fuzz.rs
index ca87a47..4e48f1d 100644
--- a/fuzz/fuzz.rs
+++ b/fuzz/fuzz.rs
@@ -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");