[clang] f515d7a - [Static analysis] Encodes a filename before inserting it into a URL. (#120123)

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 16 23:15:36 PST 2024


Author: Ryosuke Niwa
Date: 2024-12-16T23:15:32-08:00
New Revision: f515d7aa720142dfbb72f52e9d0106ba33e1fe69

URL: https://github.com/llvm/llvm-project/commit/f515d7aa720142dfbb72f52e9d0106ba33e1fe69
DIFF: https://github.com/llvm/llvm-project/commit/f515d7aa720142dfbb72f52e9d0106ba33e1fe69.diff

LOG: [Static analysis] Encodes a filename before inserting it into a URL. (#120123)

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..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";


        


More information about the cfe-commits mailing list