From 71227c64df4d4e6c5c01078bbcfbbc1e47f0f140 Mon Sep 17 00:00:00 2001 From: Christer Fletcher Date: Tue, 16 Dec 2025 09:15:24 +0100 Subject: [PATCH] stylize_as_junit.rb: XML escape test name If you had a TEST_CASE which contained a quoted string as a parameter then the xml generated would be invalid. --- auto/stylize_as_junit.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/auto/stylize_as_junit.rb b/auto/stylize_as_junit.rb index e003918a..05f8ee6b 100755 --- a/auto/stylize_as_junit.rb +++ b/auto/stylize_as_junit.rb @@ -6,6 +6,7 @@ # SPDX-License-Identifier: MIT # ========================================================================= +require 'cgi' require 'fileutils' require 'optparse' require 'ostruct' @@ -143,6 +144,7 @@ def get_details(_result_file, lines) lines.each do |line| line = line.tr('\\', '/') _src_file, src_line, test_name, status, msg = line.split(/:/) + test_name = CGI.escapeHTML(test_name.to_s) case status when 'IGNORE' then results[:ignores] << { test: test_name, line: src_line, message: msg } when 'FAIL' then results[:failures] << { test: test_name, line: src_line, message: msg }