[clang] 04383d6 - [Static analysis] Encodes a filename before inserting it into a URL. (#120810)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 17 13:31:59 PST 2025
Author: Ryosuke Niwa
Date: 2025-01-17T13:31:56-08:00
New Revision: 04383d63130a72c1280d80ec3f5a09dfdf607462
URL: https://github.com/llvm/llvm-project/commit/04383d63130a72c1280d80ec3f5a09dfdf607462
DIFF: https://github.com/llvm/llvm-project/commit/04383d63130a72c1280d80ec3f5a09dfdf607462.diff
LOG: [Static analysis] Encodes a filename before inserting it into a URL. (#120810)
This fixes a bug where report links generated from files such as
StylePrimitiveNumericTypes+Conversions.h in WebKit result in an error.
---------
Co-authored-by: Brianna Fan <bfan2 at apple.com>
Added:
Modified:
clang/tools/scan-build/bin/scan-build
Removed:
################################################################################
diff --git a/clang/tools/scan-build/bin/scan-build b/clang/tools/scan-build/bin/scan-build
index 37241c6d85c5b2..b90e635d31757b 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,16 @@ sub HtmlEscape {
return $tmp;
}
+##----------------------------------------------------------------------------##
+# URLEscape - encode characters that are special in URLs
+##----------------------------------------------------------------------------##
+
+sub URLEscape {
+ my $arg = shift || '';
+ $arg =~ s/\+/%2B/g;
+ return $arg;
+}
+
##----------------------------------------------------------------------------##
# ShellEscape - backslash escape characters that are special to the shell
##----------------------------------------------------------------------------##
More information about the cfe-commits
mailing list