Attach the symbols of this call's args with Arg-taint summary.
(
store_mgr: &mut StoreMgr<TaintDataVec>,
env_mgr: &mut EnvMgr<TaintDataVec>,
call: &ast::Node,
)
| 571 | |
| 572 | /// Attach the symbols of this call's args with Arg-taint summary. |
| 573 | fn adg_precall( |
| 574 | store_mgr: &mut StoreMgr<TaintDataVec>, |
| 575 | env_mgr: &mut EnvMgr<TaintDataVec>, |
| 576 | call: &ast::Node, |
| 577 | ) { |
| 578 | let call_id = call.id; |
| 579 | let name = call.get_call_name(); |
| 580 | if !is_library_api(&name) { |
| 581 | return; |
| 582 | } |
| 583 | log::trace!("Visit [Precall]: {}", name); |
| 584 | for (i, arg_stmt) in call.get_call_arg_stmts().iter().enumerate() { |
| 585 | let arg = arg_stmt.get_var_name(); |
| 586 | if arg.is_empty() { |
| 587 | continue; |
| 588 | } |
| 589 | // currently do not differ array and array's elements. |
| 590 | let arg = arg.get_base(); |
| 591 | let data = TaintData::new(call_id, name.clone(), Taintkind::Arg(i as u8)); |
| 592 | // if this arg is a callStmt. |
| 593 | if arg_stmt.is_call() { |
| 594 | Self::adg_precall(store_mgr, env_mgr, arg_stmt); |
| 595 | let mut sym = env_mgr.create_object_for_call(call).unwrap(); |
| 596 | Self::adg_post_call(store_mgr, arg_stmt, &mut sym); |
| 597 | sym.get_data_mut().push(data); |
| 598 | store_mgr.ssa_bind_value(arg, sym).unwrap(); |
| 599 | } else { |
| 600 | // else, get bind of var. |
| 601 | let sym = store_mgr.get_bind_mut(&arg); |
| 602 | if let Ok(sym) = sym { |
| 603 | sym.get_data_mut().push(data); |
| 604 | } |
| 605 | // if bind of var isn't existed. e.g., global var in external libraries. |
| 606 | else { |
| 607 | //log::warn!("{sym:?}"); |
| 608 | let mut sym = env_mgr.create_dummy_object(); |
| 609 | sym.get_data_mut().push(data.clone()); |
| 610 | store_mgr.ssa_bind_value(arg, sym).unwrap(); |
| 611 | } |
| 612 | } |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | /// Attach the symbols of this call's args with Call-taint summary. |
| 617 | fn adg_post_call( |
nothing calls this directly
no test coverage detected