MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / collect_fuzzable_array_args

Function collect_fuzzable_array_args

src/program/transform.rs:1288–1328  ·  view source on GitHub ↗
(
    call_name: &str,
    call: &Node,
    n_call: usize,
    constraints: &APIConstraints,
    visitor: &Visitor,
)

Source from the content-addressed store, hash-verified

1286}
1287
1288fn collect_fuzzable_array_args(
1289 call_name: &str,
1290 call: &Node,
1291 n_call: usize,
1292 constraints: &APIConstraints,
1293 visitor: &Visitor,
1294) -> Vec<FuzzVariant> {
1295 // get the positions of constant array parameters of this API call.
1296 let const_array_pos = super::gadget::get_fuzzable_funcs()
1297 .get(call_name)
1298 .unwrap()
1299 .to_vec();
1300 let const_array_pos: Vec<&usize> = const_array_pos
1301 .iter()
1302 .filter(|array_pos| !filter_constrained_array_args(constraints, call_name, array_pos))
1303 .collect();
1304 let mut fuzz_args = Vec::new();
1305 for arg_pos in const_array_pos {
1306 let arg = get_nth_arg(call, *arg_pos).unwrap();
1307 if let Clang::CXXDefaultArgExpr = &arg.kind {
1308 continue;
1309 }
1310 if arg.is_macro_expansion() {
1311 continue;
1312 }
1313 if is_read_from_file(arg, visitor) || !is_arg_fuzzable(arg, visitor) {
1314 continue;
1315 }
1316 // read from file, needn't transform
1317 let constraint = get_array_arg_constraint(constraints, call_name, arg_pos);
1318 let variant = FuzzVariant::new(
1319 call_name.to_string(),
1320 call.clone(),
1321 n_call,
1322 *arg_pos,
1323 constraint,
1324 );
1325 fuzz_args.push(variant);
1326 }
1327 fuzz_args
1328}
1329
1330fn collect_fuzzable_integer_args(
1331 call_name: &str,

Callers 1

Calls 8

get_fuzzable_funcsFunction · 0.85
get_nth_argFunction · 0.85
is_read_from_fileFunction · 0.85
is_arg_fuzzableFunction · 0.85
get_array_arg_constraintFunction · 0.85
is_macro_expansionMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected