Skip to content

Commit b9a4cd4

Browse files
committed
Improved precision of collecting taint-potential access paths.
1 parent 953859d commit b9a4cd4

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

src/taint-analysis/taint_summary.cpp

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -702,20 +702,31 @@ void taint_algorithm_computing_summary_of_functiont::initialise_domain(
702702
const auto &fn_type=
703703
program->get_functions().function_map.at(callee_id).type;
704704

705-
for(const auto &arg : fn_call.arguments())
705+
if(!database.contains(callee_id) || transition_rules->has_rule(callee_id))
706706
{
707-
collect_lvsa_access_paths(
708-
arg,
709-
program->get_namespace(),
710-
environment,
711-
lvsa,
712-
it,
713-
*numbering);
707+
// This is either a recursive function or a function for which we have
708+
// a rule (any function not in the database has not been processed and
709+
// since we're following an inverted topological ordering it therefore
710+
// must recursively call us)
711+
// If we don't have a summary then we assume that the function could
712+
// use any of its arguments. If the function has a rule then it
713+
// probably will use some of its arguments.
714+
// In the future we could be more precise about exactly which arguments
715+
// are used in the rule.
716+
for(const auto &arg : fn_call.arguments())
717+
{
718+
collect_lvsa_access_paths(
719+
arg,
720+
program->get_namespace(),
721+
environment,
722+
lvsa,
723+
it,
724+
*numbering);
725+
}
726+
if(!database.contains(callee_id))
727+
continue;
714728
}
715729

716-
if(!database.contains(callee_id))
717-
continue;
718-
719730
const std::shared_ptr<taint_summaryt> summary = database.at(callee_id);
720731
for(const std::pair<taint_lvalue_numbert, taint_variablet>& input
721732
: summary->input)

0 commit comments

Comments
 (0)