https://github.com/rniwa created 
https://github.com/llvm/llvm-project/pull/120123

This fixes a bug where report links generated from files such as 
StylePrimitiveNumericTypes+Conversions.h in WebKit result in an error.

>From ac1fd2653d009760b5cb46a2bf6c5d1c3f52fc41 Mon Sep 17 00:00:00 2001
From: Brianna Fan <bf...@apple.com>
Date: Mon, 16 Dec 2024 10:29:05 -0800
Subject: [PATCH] [Static analysis] Encodes a filename before inserting it into
 a URL.

This fixes a bug where report links generated from files such as
StylePrimitiveNumericTypes+Conversions.h in WebKit result in an error.
---
 clang/tools/scan-build/bin/scan-build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/tools/scan-build/bin/scan-build 
b/clang/tools/scan-build/bin/scan-build
index 37241c6d85c5b2..1df043ef8b72bd 100755
--- a/clang/tools/scan-build/bin/scan-build
+++ b/clang/tools/scan-build/bin/scan-build
@@ -23,6 +23,7 @@ use Term::ANSIColor qw(:constants);
 use Cwd qw/ getcwd abs_path /;
 use Sys::Hostname;
 use Hash::Util qw(lock_keys);
+use URI::Escape;
 
 my $Prog = "scan-build";
 my $BuildName;
@@ -820,7 +821,8 @@ ENDTEXT
       }
 
       # Emit the "View" link.
-      print OUT "<td><a href=\"$ReportFile#EndPath\">View Report</a></td>";
+      my $EncodedReport = uri_escape($ReportFile, "^A-Za-z0-9\-\._~\/");
+      print OUT "<td><a href=\"$EncodedReport#EndPath\">View Report</a></td>";
 
       # Emit REPORTBUG markers.
       print OUT "\n<!-- REPORTBUG id=\"$ReportFile\" -->\n";

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to