21 const std::string &file_name,
30 message.
error() <<
"taint file is not a valid json file"
38 message.
error() <<
"expecting an array in the taint file, but got "
45 if(!taint_spec.is_object())
48 message.
error() <<
"expecting an array of objects "
49 <<
"in the taint file, but got " << taint_spec
56 const std::string kind = taint_spec[
"kind"].value;
62 else if(kind==
"sanitizer")
67 message.
error() <<
"taint rule must have \"kind\" which is "
68 "\"source\" or \"sink\" or \"sanitizer\""
73 const std::string
function = taint_spec[
"function"].value;
78 message.
error() <<
"taint rule must have \"function\""
85 const std::string where = taint_spec[
"where"].value;
87 if(where==
"return_value")
95 else if(std::string(where, 0, 9)==
"parameter")
104 message.
error() <<
"taint rule must have \"where\""
105 <<
" which is \"return_value\" or \"this\" "
106 <<
"or \"parameter1\"..."
111 rule.
taint = taint_spec[
"taint"].value;
112 rule.
message = taint_spec[
"message"].value;
113 rule.
id = taint_spec[
"id"].value;
115 dest.
rules.push_back(rule);
128 case SOURCE: out <<
"SOURCE ";
break;
129 case SINK: out <<
"SINK ";
break;
130 case SANITIZER: out <<
"SANITIZER ";
break;
133 out <<
taint <<
" on ";
148 for(
const auto &rule :
rules)
Class that provides messages with a built-in verbosity 'level'.
enum taint_parse_treet::rulet::@2 where
void output(std::ostream &) const
irep_idt function_identifier
enum taint_parse_treet::rulet::@1 kind
unsigned parameter_number
void output(std::ostream &) const
const std::string & id2string(const irep_idt &d)
json_arrayt & to_json_array(jsont &json)
bool parse_json(std::istream &in, const std::string &filename, message_handlert &message_handler, jsont &dest)
static void json(json_objectT &result, const irep_idt &property_id, const property_infot &property_info)
unsigned safe_string2unsigned(const std::string &str, int base)
bool taint_parser(const std::string &file_name, taint_parse_treet &dest, message_handlert &message_handler)