(
call_name: &str,
call: &Node,
n_call: usize,
constraints: &APIConstraints,
visitor: &Visitor,
)
| 1328 | } |
| 1329 | |
| 1330 | fn collect_fuzzable_integer_args( |
| 1331 | call_name: &str, |
| 1332 | call: &Node, |
| 1333 | n_call: usize, |
| 1334 | constraints: &APIConstraints, |
| 1335 | visitor: &Visitor, |
| 1336 | ) -> Vec<FuzzVariant> { |
| 1337 | // get the positions of integer (scalar) type parameters of this API call. |
| 1338 | let integeral_pos = get_func_gadget(call_name).unwrap().get_integer_params_pos(); |
| 1339 | // filter out the positions inferred with constraints. |
| 1340 | let integeral_pos: Vec<&usize> = integeral_pos |
| 1341 | .iter() |
| 1342 | .filter(|x| !filter_constrained_integer_args(constraints, call_name, x)) |
| 1343 | .collect(); |
| 1344 | let mut fuzz_args = Vec::new(); |
| 1345 | for arg_pos in integeral_pos { |
| 1346 | let arg = get_nth_arg(call, *arg_pos).unwrap(); |
| 1347 | if let Clang::CXXDefaultArgExpr = &arg.kind { |
| 1348 | continue; |
| 1349 | } |
| 1350 | if arg.is_macro_expansion() { |
| 1351 | continue; |
| 1352 | } |
| 1353 | if is_ret_by_call(call_name, *arg_pos, visitor) || !is_arg_fuzzable(arg, visitor) { |
| 1354 | continue; |
| 1355 | } |
| 1356 | // read from file, needn't transform |
| 1357 | let variant = FuzzVariant::new(call_name.to_string(), call.clone(), n_call, *arg_pos, None); |
| 1358 | fuzz_args.push(variant); |
| 1359 | } |
| 1360 | fuzz_args |
| 1361 | } |
| 1362 | |
| 1363 | impl Visitor { |
| 1364 | /// Analyze the AST of the program. Collect the API calls that contained the fuzzable arguments. |
no test coverage detected