Bug in kyua report-html
tuexen at freebsd.org
tuexen at freebsd.org
Tue Apr 13 11:53:06 UTC 2021
Dear all,
there is a bug in the generation of the html: Output like
stderr:
/home/tuexen/tcp-testsuite/fast-open/client/client-handle-cookie-reject-of-length-32.pkt:49: error handling packet: live packet field ipv4_total_length: expected: 64 (0x40) vs actual: 60 (0x3c)
script packet: 0.174887 S 0:0(0) win 65535 <mss 1460,nop,wscale 6,sackOK,TS val 0 ecr 0,FO,eol,eol>
actual packet: 0.100378 S 0:0(0) win 65535 <mss 1460,nop,wscale 6,sackOK,TS val 0 ecr 0>
is not escaped such that parts starting with < are not rendered correclty.
A proposed fix would be:
diff --git a/contrib/kyua/cli/cmd_report_html.cpp b/contrib/kyua/cli/cmd_report_html.cpp
index b2133a8de04..9c99e434825 100644
--- a/contrib/kyua/cli/cmd_report_html.cpp
+++ b/contrib/kyua/cli/cmd_report_html.cpp
@@ -54,6 +54,7 @@
#include "utils/fs/operations.hpp"
#include "utils/fs/path.hpp"
#include "utils/optional.ipp"
+#include "utils/text/operations.hpp"
#include "utils/text/templates.hpp"
namespace cmdline = utils::cmdline;
@@ -365,12 +366,12 @@ class html_hooks : public drivers::scan_results::base_hooks {
{
const std::string stdout_text = iter.stdout_contents();
if (!stdout_text.empty())
- templates.add_variable("stdout", stdout_text);
+ templates.add_variable("stdout", text::escape_xml(stdout_text));
}
{
const std::string stderr_text = iter.stderr_contents();
if (!stderr_text.empty())
- templates.add_variable("stderr", stderr_text);
+ templates.add_variable("stderr", text::escape_xml(stderr_text));
}
generate(templates, "test_result.html",
Should I open a review on phabricator to get this into the FreeBSD source tree or should I submit
the fix to some other upstream repo, since the kyua code is in the contrib folder.
Best regards
Michael
More information about the freebsd-testing
mailing list