From e9ca38a8fa1c9328f259a537e1268b4ca67dff16 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 19 Nov 2023 20:33:49 +0100 Subject: [PATCH 1/2] expr fuzz: add missing ops. found thanks to oss fuzz coverage https://storage.googleapis.com/oss-fuzz-coverage/rust-coreutils/reports/20231118/linux/src/rust-coreutils/src/uu/expr/src/syntax_tree.rs.html --- fuzz/fuzz_targets/fuzz_expr.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fuzz/fuzz_targets/fuzz_expr.rs b/fuzz/fuzz_targets/fuzz_expr.rs index ce5535b16e1..76df9992ee8 100644 --- a/fuzz/fuzz_targets/fuzz_expr.rs +++ b/fuzz/fuzz_targets/fuzz_expr.rs @@ -21,7 +21,9 @@ static CMD_PATH: &str = "expr"; fn generate_expr(max_depth: u32) -> String { let mut rng = rand::thread_rng(); - let ops = ["+", "-", "*", "/", "%", "<", ">", "=", "&", "|"]; + let ops = [ + "+", "-", "*", "/", "%", "<", ">", "=", "&", "|", "!=", "<=", ">=", ":", "length", "substr", + ]; let mut expr = String::new(); let mut depth = 0; From a0a209f65fe5560283ef3f45e71ed7f37e073c57 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 21 Nov 2023 11:20:20 +0100 Subject: [PATCH 2/2] add index too Co-authored-by: Daniel Hofstetter --- fuzz/fuzz_targets/fuzz_expr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuzz/fuzz_targets/fuzz_expr.rs b/fuzz/fuzz_targets/fuzz_expr.rs index 76df9992ee8..9f2d28603ab 100644 --- a/fuzz/fuzz_targets/fuzz_expr.rs +++ b/fuzz/fuzz_targets/fuzz_expr.rs @@ -22,7 +22,7 @@ static CMD_PATH: &str = "expr"; fn generate_expr(max_depth: u32) -> String { let mut rng = rand::thread_rng(); let ops = [ - "+", "-", "*", "/", "%", "<", ">", "=", "&", "|", "!=", "<=", ">=", ":", "length", "substr", + "+", "-", "*", "/", "%", "<", ">", "=", "&", "|", "!=", "<=", ">=", ":", "index", "length", "substr", ]; let mut expr = String::new();