Skip to content

Commit bb648b8

Browse files
NathanJPhillipssmowton
authored andcommitted
Merge pull request diffblue#142 from NathanJPhillips/feature/dont-ignore-config-errors
Abort on most config files errors
1 parent 8ed81a6 commit bb648b8

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/goto-analyzer/taint_rules.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ std::unique_ptr<taint_rulest> taint_rulest::load(
235235
{
236236
msg.error()
237237
<< "Rule in taint configuration file was a "
238-
<< rule_json << " instead of an object, ignoring it." << messaget::eom;
239-
continue;
238+
<< rule_json << " instead of an object, aborting load." << messaget::eom;
239+
return nullptr;
240240
}
241241

242242
const std::string comment = rule_json["comment"].value,
@@ -249,25 +249,25 @@ std::unique_ptr<taint_rulest> taint_rulest::load(
249249
if(!method_name.empty())
250250
{
251251
msg.error()
252-
<< "Rule in taint configuration file contains method name attribute and also sets constructor to true, ignoring it"
252+
<< "Rule in taint configuration file contains method name attribute and also sets constructor to true, aborting load."
253253
<< messaget::eom;
254-
continue;
254+
return nullptr;
255255
}
256256
method_name = "<init>";
257257
}
258258
if(class_name.empty())
259259
{
260260
msg.error()
261-
<< "Rule in taint configuration file does not contain class attribute, ignoring it"
261+
<< "Rule in taint configuration file does not contain class attribute, aborting load."
262262
<< messaget::eom;
263-
continue;
263+
return nullptr;
264264
}
265265
if(method_name.empty())
266266
{
267267
msg.error()
268-
<< "Rule in taint configuration file does not contain method attribute, ignoring it"
268+
<< "Rule in taint configuration file does not contain method attribute, aborting load."
269269
<< messaget::eom;
270-
continue;
270+
return nullptr;
271271
}
272272
method_name = class_name + "." + method_name;
273273
auto fn_details = fn_details_map.equal_range(method_name);
@@ -276,9 +276,9 @@ std::unique_ptr<taint_rulest> taint_rulest::load(
276276
msg.error()
277277
<< "Rule in taint configuration file refers to "
278278
<< method_name
279-
<< ": a method that we could not find in the goto program, ignoring it"
279+
<< ": a method that we could not find in the goto program, aborting load."
280280
<< messaget::eom;
281-
continue;
281+
return nullptr;
282282
}
283283

284284
// Load all the possible locations from JSON
@@ -349,8 +349,9 @@ std::unique_ptr<taint_rulest> taint_rulest::load(
349349
}
350350
else
351351
msg.error()
352-
<< "Rule has neither result nor sinkTarget, ignoring it."
352+
<< "Rule has neither result nor sinkTarget, aborting load."
353353
<< messaget::eom;
354+
return nullptr;
354355
}
355356

356357
return rules->is_empty() ? nullptr : move(rules);

0 commit comments

Comments
 (0)