[Lldb-commits] [lldb] r323817 - XUnit Formatter: Handle UTF-8 decode errors on invalid XML
Vedant Kumar via lldb-commits
lldb-commits at lists.llvm.org
Tue Jan 30 13:16:42 PST 2018
Author: vedantk
Date: Tue Jan 30 13:16:42 2018
New Revision: 323817
URL: http://llvm.org/viewvc/llvm-project?rev=323817&view=rev
Log:
XUnit Formatter: Handle UTF-8 decode errors on invalid XML
Strings which contain garbage data can trigger an exception in the XUnit
plugin at the UTF-8 decode step because the decode is strict. Use a lax
mode to avoid an exception.
See: https://ci.swift.org/job/oss-lldb-incremental-osx/780
Modified:
lldb/trunk/packages/Python/lldbsuite/test_event/formatter/xunit.py
Modified: lldb/trunk/packages/Python/lldbsuite/test_event/formatter/xunit.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test_event/formatter/xunit.py?rev=323817&r1=323816&r2=323817&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test_event/formatter/xunit.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test_event/formatter/xunit.py Tue Jan 30 13:16:42 2018
@@ -84,7 +84,9 @@ class XunitFormatter(ResultsFormatter):
"""
# Get the content into unicode
if isinstance(str_or_unicode, str):
- unicode_content = str_or_unicode.decode('utf-8')
+ # If we hit decoding errors due to data corruption, replace the
+ # invalid characters with U+FFFD REPLACEMENT CHARACTER.
+ unicode_content = str_or_unicode.decode('utf-8', 'replace')
else:
unicode_content = str_or_unicode
return self.invalid_xml_re.sub(
More information about the lldb-commits
mailing list