@@ -836,8 +836,6 @@ void taint_algorithm_computing_summary_of_functiont::initialise_domain(
836
836
}
837
837
}
838
838
839
- numbered_lvalue_to_taint_mapt entry_map;
840
- numbered_lvalue_to_taint_mapt others_map;
841
839
for (const auto lvaluenum : environment)
842
840
{
843
841
const taint_lvaluet &lvalue=numbering->at (lvaluenum);
@@ -852,18 +850,15 @@ void taint_algorithm_computing_summary_of_functiont::initialise_domain(
852
850
{
853
851
taint_variablet v = taint_variablet::fresh ();
854
852
caller_summary.input .insert ({ lvaluenum, v });
855
- entry_map.insert ({lvaluenum, taint_sett::from_variable (v) });
856
- others_map.insert ({lvaluenum, taint_sett () });
857
853
}
858
854
}
859
855
860
- caller_summary.domain .insert (
861
- { function.body .instructions .cbegin (), entry_map });
862
- for (auto it = std::next (function.body .instructions .cbegin ());
856
+ numbered_lvalue_to_taint_mapt initial_map;
857
+ for (auto it = function.body .instructions .cbegin ();
863
858
it != function.body .instructions .cend ();
864
859
++it)
865
860
{
866
- caller_summary.domain .insert ({ it, others_map });
861
+ caller_summary.domain .insert ({ it, initial_map });
867
862
}
868
863
869
864
// Now that all maps have been created, replace those with a unique
@@ -913,6 +908,7 @@ void taint_algorithm_computing_summary_of_functiont::initialise_domain(
913
908
void taint_algorithm_computing_summary_of_functiont::handle_assignment (
914
909
const code_assignt& asgn,
915
910
numbered_lvalue_to_taint_mapt const & a,
911
+ const taint_summary_inputt &input,
916
912
numbered_lvalue_to_taint_mapt& result,
917
913
instruction_iteratort const & Iit,
918
914
local_value_set_analysist &lvsa)
@@ -931,30 +927,16 @@ void taint_algorithm_computing_summary_of_functiont::handle_assignment(
931
927
handle_assignment (
932
928
member_assign,
933
929
a,
930
+ input,
934
931
result,
935
932
Iit,
936
933
lvsa);
937
934
}
938
935
return ;
939
936
}
940
937
941
- taint_sett taint;
942
- {
943
- lvalue_numbers_sett rhs;
944
- collect_lvsa_access_paths (
945
- asgn.rhs (),
946
- program->get_namespace (),
947
- rhs,
948
- lvsa,
949
- Iit,
950
- *numbering);
951
- for (const auto &lvalue : rhs)
952
- {
953
- const auto it=a.find (lvalue);
954
- if (it!=a.cend ())
955
- taint|=it->second ;
956
- }
957
- }
938
+ taint_sett taint = compute_taint_of_aliased_numbers_of_lvalue (
939
+ asgn.rhs (), Iit, lvsa, input, a);
958
940
959
941
lvalue_numbers_sett lhs;
960
942
bool singular=false ;
@@ -987,6 +969,7 @@ taint_sett taint_algorithm_computing_summary_of_functiont::
987
969
const taint_lvaluet &lvalue,
988
970
const instruction_iteratort &Iit,
989
971
local_value_set_analysist &lvsa,
972
+ const taint_summary_inputt &input,
990
973
const numbered_lvalue_to_taint_mapt &a)
991
974
{
992
975
TMPROF_BLOCK ();
@@ -1005,6 +988,12 @@ taint_sett taint_algorithm_computing_summary_of_functiont::
1005
988
auto it=a.find (lvalue_number);
1006
989
if (it!=a.cend ())
1007
990
result |= it->second ;
991
+ else
992
+ {
993
+ const auto input_it = input.find (lvalue_number);
994
+ if (input_it != input.cend ())
995
+ result += input_it->second ;
996
+ }
1008
997
}
1009
998
return result;
1010
999
}
@@ -1059,6 +1048,7 @@ numbered_lvalue_to_taint_mapt taint_algorithm_computing_summary_of_functiont::
1059
1048
const numbered_lvalue_to_taint_mapt &a,
1060
1049
const instruction_iteratort &Iit,
1061
1050
const irep_idt &caller_ident,
1051
+ const taint_summary_inputt &input,
1062
1052
taint_summaryt::dbt &database,
1063
1053
local_value_set_analysist &lvsa,
1064
1054
taint_transition_propertiest &transition_properties)
@@ -1089,7 +1079,7 @@ numbered_lvalue_to_taint_mapt taint_algorithm_computing_summary_of_functiont::
1089
1079
{
1090
1080
taint_sett taint =
1091
1081
compute_taint_of_aliased_numbers_of_lvalue (
1092
- replace_it->second , Iit, lvsa, a);
1082
+ replace_it->second , Iit, lvsa, input, a);
1093
1083
1094
1084
lvalue_numbers_sett numbers_of_aliases;
1095
1085
collect_lvsa_access_paths (
@@ -1140,7 +1130,7 @@ numbered_lvalue_to_taint_mapt taint_algorithm_computing_summary_of_functiont::
1140
1130
}
1141
1131
}
1142
1132
}
1143
- handle_assignment (asgn, a, result, Iit, lvsa);
1133
+ handle_assignment (asgn, a, input, result, Iit, lvsa);
1144
1134
}
1145
1135
break ;
1146
1136
case FUNCTION_CALL:
@@ -1230,6 +1220,7 @@ numbered_lvalue_to_taint_mapt taint_algorithm_computing_summary_of_functiont::
1230
1220
propagation_rule.get_input_location ().arg_index ),
1231
1221
Iit,
1232
1222
lvsa,
1223
+ input,
1233
1224
a))
1234
1225
: propagation_rule.apply ();
1235
1226
@@ -1362,13 +1353,15 @@ numbered_lvalue_to_taint_mapt taint_algorithm_computing_summary_of_functiont::
1362
1353
sink_rule.get_input_location ().arg_index ),
1363
1354
Iit,
1364
1355
lvsa,
1356
+ input,
1365
1357
a)
1366
1358
: taint_sett{},
1367
1359
compute_taint_of_aliased_numbers_of_lvalue (
1368
1360
fn_call.arguments ().at (
1369
1361
sink_rule.get_sink_target_location ().arg_index ),
1370
1362
Iit,
1371
1363
lvsa,
1364
+ input,
1372
1365
a),
1373
1366
sink_conditions);
1374
1367
@@ -1449,6 +1442,7 @@ numbered_lvalue_to_taint_mapt taint_algorithm_computing_summary_of_functiont::
1449
1442
handle_assignment (
1450
1443
fake_assignment,
1451
1444
a,
1445
+ input,
1452
1446
result,
1453
1447
Iit,
1454
1448
lvsa);
@@ -1708,6 +1702,7 @@ void taint_algorithm_computing_summary_of_functiont::
1708
1702
src_value,
1709
1703
src_instr_it,
1710
1704
function_id,
1705
+ summary->input ,
1711
1706
database,
1712
1707
lvsa,
1713
1708
summary->transition_props );
0 commit comments