(
call_name: &str,
call: &Node,
n_call: usize,
constraints: &APIConstraints,
visitor: &Visitor,
)
| 1286 | } |
| 1287 | |
| 1288 | fn 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 | |
| 1330 | fn collect_fuzzable_integer_args( |
| 1331 | call_name: &str, |
no test coverage detected