@@ -72,6 +72,18 @@ dumper taint_condt::dump(const taint_tokent::named_tokenst &named_tokens) const
72
72
});
73
73
}
74
74
75
+ dumper taint_subject_conditiont::dump (
76
+ const taint_tokent::named_tokenst &named_tokens) const
77
+ {
78
+ return dumper (
79
+ [this , &named_tokens] (std::ostream &ostr)
80
+ {
81
+ ostr
82
+ << condition.get_name (named_tokens)
83
+ << " \u2208 " << subject;
84
+ });
85
+ }
86
+
75
87
void taint_functions_for_dumping_taint_summary_in_htmlt::
76
88
taint_dump_lvalue_in_html (
77
89
const taint_lvaluet &lvalue,
@@ -185,6 +197,31 @@ bool taint_functions_for_dumping_taint_summary_in_htmlt::
185
197
const bool dump_differce_of_abstract_values,
186
198
std::ostream& ostr)
187
199
{
200
+ ostr << " <table>\n "
201
+ " <caption>Formal parameters of the function.</caption>\n "
202
+ " <tr>\n "
203
+ " <th>Index</th>\n "
204
+ " <th>Name</th>\n "
205
+ " <th>Type</th>\n "
206
+ " </tr>\n "
207
+ ;
208
+ assert (program.get_namespace ().get_symbol_table ().has_symbol (fn_id));
209
+ const symbolt &fn_symbol=program.get_namespace ().lookup (fn_id);
210
+ const code_typet &fn_type=to_code_type (fn_symbol.type );
211
+ for (std::size_t i=0UL , n=fn_type.parameters ().size (); i!=n; ++i)
212
+ {
213
+ const code_typet::parametert ¶m=fn_type.parameters ().at (i);
214
+ ostr << " <tr>\n "
215
+ " <td>" << i << " </td>\n "
216
+ " <td>" << param.get_base_name () << " </td>\n "
217
+ " <td>" << to_html_text (from_type (program.get_namespace ()," " ,
218
+ param.type ()))
219
+ << " </td>\n "
220
+ " </tr>\n "
221
+ ;
222
+ }
223
+ ostr << " </table>\n " ;
224
+
188
225
ostr << " <h2>Taint summary</h2>\n "
189
226
<< " <p>Mapping of input to symbols:</p>\n "
190
227
" <table>\n "
@@ -257,9 +294,9 @@ bool taint_functions_for_dumping_taint_summary_in_htmlt::
257
294
" <tr>\n "
258
295
" <th>Loc</th>\n "
259
296
" <th>Targets</th>\n "
260
- " <th style= \" width:150px; \" >Instruction</th>\n "
261
- " <th style= \" width:150px; \" >Domain value</th>\n "
262
- " <th>Comment</th>\n "
297
+ " <th>Instruction</th>\n "
298
+ " <th>Domain value</th>\n "
299
+ " <th style= \" width:300px; \" >Comment</th>\n "
263
300
" </tr>\n " ;
264
301
for (auto instr_it = fn_body.instructions .cbegin ();
265
302
instr_it!=fn_body.instructions .cend ();
@@ -281,7 +318,7 @@ bool taint_functions_for_dumping_taint_summary_in_htmlt::
281
318
282
319
// Dumping instruction
283
320
ostr << " <td>\n " ;
284
- dump_instruction_code_in_html (*instr_it, program.get_model (), ostr);
321
+ dump_instruction_code_in_html (*instr_it, program.get_namespace (), ostr);
285
322
ostr << " </td>\n " ;
286
323
287
324
// Dumping taint domain
@@ -339,16 +376,46 @@ bool taint_functions_for_dumping_taint_summary_in_htmlt::
339
376
ostr << " Function summary was applied." ;
340
377
break ;
341
378
case taint_transition_property_typet::APPLICATION_OF_PROPAGATION_RULE:
342
- ostr << " Propagation rule was applied. " ;
379
+ ostr << " Propagation rule '"
380
+ << to_html_text (props.get_rule_id ())
381
+ << " ' was applied." ;
343
382
break ;
344
383
case taint_transition_property_typet::APPLICATION_OF_SANITISATION_RULE:
345
- ostr << " Sanitisation rule was applied." ;
384
+ ostr << " Sanitisation rule '"
385
+ << to_html_text (props.get_rule_id ())
386
+ << " ' was applied." ;
346
387
break ;
347
388
case taint_transition_property_typet::APPLICATION_OF_SINK_RULE:
348
- ostr << " Sink rule was applied." ;
389
+ ostr << " Sink rule '"
390
+ << to_html_text (props.get_rule_id ())
391
+ << " ' was applied." ;
349
392
break ;
350
393
case taint_transition_property_typet::CONDITIONAL_APPLICATION_OF_SINK_RULE:
351
- ostr << " The sink rule would be applied if conditions were met." ;
394
+ {
395
+ ostr << " The sink rule '"
396
+ << to_html_text (props.get_rule_id ())
397
+ << " ' would be applied if " ;
398
+ bool first_and=true ;
399
+ for (const auto & set : props.get_sink_conditions ())
400
+ {
401
+ if (!first_and)
402
+ ostr << " and " ;
403
+ if (props.get_sink_conditions ().size ()>1U && set.size ()>1U )
404
+ ostr << " ( " ;
405
+ bool first_or=true ;
406
+ for (const auto & cond : set)
407
+ {
408
+ if (!first_or)
409
+ ostr << " or " ;
410
+ ostr << html_encoding () << cond.dump (named_tokens);
411
+ first_or=false ;
412
+ }
413
+ if (props.get_sink_conditions ().size ()>1U && set.size ()>1U )
414
+ ostr << " ) " ;
415
+ first_and=false ;
416
+ }
417
+ ostr << " ." ;
418
+ }
352
419
break ;
353
420
case taint_transition_property_typet::REMOVAL_OF_DEAD_VARIABLE:
354
421
ostr << " Dead variable was removed from the domain." ;
0 commit comments