diff options
author | Vedant Kumar <vsk@apple.com> | 2018-01-30 21:16:42 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-01-30 21:16:42 +0000 |
commit | e2fbd7035d14c82fa8451b81dbf72ec84665648f (patch) | |
tree | 86cc56e03f54229b3732ad96aaa83b7904c6412d /lldb/packages/Python/lldbsuite/test_event/formatter | |
parent | b7d1729787ad6d1d6e5fdd77fe23c6db020ba323 (diff) | |
download | bcm5719-llvm-e2fbd7035d14c82fa8451b81dbf72ec84665648f.tar.gz bcm5719-llvm-e2fbd7035d14c82fa8451b81dbf72ec84665648f.zip |
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
llvm-svn: 323817
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test_event/formatter')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test_event/formatter/xunit.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lldb/packages/Python/lldbsuite/test_event/formatter/xunit.py b/lldb/packages/Python/lldbsuite/test_event/formatter/xunit.py index 91487cd2c3a..4c53ff8062d 100644 --- a/lldb/packages/Python/lldbsuite/test_event/formatter/xunit.py +++ b/lldb/packages/Python/lldbsuite/test_event/formatter/xunit.py @@ -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( |