Skip to content

Commit 71227c6

Browse files
committed
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.
1 parent 51d2db9 commit 71227c6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

auto/stylize_as_junit.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# SPDX-License-Identifier: MIT
77
# =========================================================================
88

9+
require 'cgi'
910
require 'fileutils'
1011
require 'optparse'
1112
require 'ostruct'
@@ -143,6 +144,7 @@ def get_details(_result_file, lines)
143144
lines.each do |line|
144145
line = line.tr('\\', '/')
145146
_src_file, src_line, test_name, status, msg = line.split(/:/)
147+
test_name = CGI.escapeHTML(test_name.to_s)
146148
case status
147149
when 'IGNORE' then results[:ignores] << { test: test_name, line: src_line, message: msg }
148150
when 'FAIL' then results[:failures] << { test: test_name, line: src_line, message: msg }

0 commit comments

Comments
 (0)