Skip to content

Commit ef6b8d7

Browse files
authored
Merge pull request diffblue#280 from diffblue/marek/method_trace_goes_through
SEC-144: Extended 'class ErrorTraces' by method 'trace_goes_through'.
2 parents 1c3080f + 5a09714 commit ef6b8d7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

regression/end_to_end/driver.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,27 @@ def trace_exists(self, function, line_no):
5252
return True
5353
return False
5454

55+
def trace_goes_through(
56+
self,
57+
tool_name,
58+
index_into_trace, # A negative index shifts from the end
59+
goes_through_function,
60+
goes_through_line_no,
61+
end_function,
62+
end_line_no
63+
):
64+
for trace in self.traces:
65+
if tool_name in trace["error_traces"] and trace["function"] == end_function and trace["line"] == end_line_no:
66+
for error_trace in trace["error_traces"][tool_name]:
67+
try:
68+
location = error_trace[index_into_trace]["sourceLocation"]
69+
if location["function"] == goes_through_function and int(location["line"]) == goes_through_line_no:
70+
return True
71+
except:
72+
pass
73+
return False
74+
75+
5576
def run_security_analyser_pipeline(
5677
relative_binary_path,
5778
relative_rules_path,

0 commit comments

Comments
 (0)