[clang] [Static analysis] Encodes a filename before inserting it into a URL. (PR #120810)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 20 16:29:20 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Ryosuke Niwa (rniwa)
<details>
<summary>Changes</summary>
This fixes a bug where report links generated from files such as StylePrimitiveNumericTypes+Conversions.h in WebKit result in an error.
---
Full diff: https://github.com/llvm/llvm-project/pull/120810.diff
1 Files Affected:
- (modified) clang/tools/scan-build/bin/scan-build (+13-1)
``````````diff
diff --git a/clang/tools/scan-build/bin/scan-build b/clang/tools/scan-build/bin/scan-build
index 37241c6d85c5b2..66a7158062a468 100755
--- a/clang/tools/scan-build/bin/scan-build
+++ b/clang/tools/scan-build/bin/scan-build
@@ -820,7 +820,8 @@ ENDTEXT
}
# Emit the "View" link.
- print OUT "<td><a href=\"$ReportFile#EndPath\">View Report</a></td>";
+ my $EncodedReport = URLEscape($ReportFile);
+ print OUT "<td><a href=\"$EncodedReport#EndPath\">View Report</a></td>";
# Emit REPORTBUG markers.
print OUT "\n<!-- REPORTBUG id=\"$ReportFile\" -->\n";
@@ -1465,6 +1466,17 @@ sub HtmlEscape {
return $tmp;
}
+##----------------------------------------------------------------------------##
+# URLEscape - encode characters that are special in URLs
+##----------------------------------------------------------------------------##
+
+sub URLEscape {
+ my $arg = shift || '';
+ my $tmp = $arg;
+ $tmp =~ s/\+/%2B/g;
+ return $tmp;
+}
+
##----------------------------------------------------------------------------##
# ShellEscape - backslash escape characters that are special to the shell
##----------------------------------------------------------------------------##
``````````
</details>
https://github.com/llvm/llvm-project/pull/120810
More information about the cfe-commits
mailing list