From 47cded57b9e78725cdefb95fa48bd8a5ff35bb26 Mon Sep 17 00:00:00 2001 From: Keno Hassler <40292329+kenohassler@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:46:18 +0000 Subject: [PATCH] recover full source path for Infer --- .../static_analysis/sast/src/sfa/analysis/tool_runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sast-fuzz/static_analysis/sast/src/sfa/analysis/tool_runner.py b/sast-fuzz/static_analysis/sast/src/sfa/analysis/tool_runner.py index efde6f4..4662050 100644 --- a/sast-fuzz/static_analysis/sast/src/sfa/analysis/tool_runner.py +++ b/sast-fuzz/static_analysis/sast/src/sfa/analysis/tool_runner.py @@ -269,7 +269,11 @@ def _format(self, string: str) -> SASTFlags: line = flag["line"] vuln = flag["bug_type"] - file = Path(file).name + # remove the temp prefix from the path, but keep the rest + fparts = Path(file).parts + assert fparts[0] == "/" and fparts[1] == "tmp" + tmp_source = Path(fparts[0] + fparts[1]) / fparts[2] / fparts[3] + file = str(Path(file).relative_to(tmp_source)) flags.add(SASTFlag(tool, file, line, vuln))