diff options
| author | Leitwolf11 | 2026-11-15 22:29:48 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-15 22:29:48 +0300 |
| commit | 79f624d693b4fc3167c239c3eca47c858799333f (patch) | |
| tree | d42816753aa7f421e92dceba4e4e2b264b1a4773 /tests/TestScripts | |
| parent | 6750f61c28be2861280078328e164e88bc1dfe44 (diff) | |
| download | catch3-79f624d693b4fc3167c239c3eca47c858799333f.tar.gz | |
Bound three string and XML reads that analysis flagged
- On macOS, the path from _NSGetExecutablePath is cut at its first NUL
found inside the buffer, in place of strlen, which reads until a NUL
wherever it is.
- The table test measures its C strings with std::string_view.
- The Bazel reporter test reads the JUnit report and rejects a document
type before parsing it, so no entity, external or internal, is ever
expanded.
Claude-Session: https://claude.ai/code/session_01Ji7xZMYjc4zankoc7hGBE1
Diffstat (limited to 'tests/TestScripts')
| -rw-r--r-- | tests/TestScripts/testBazelReporter.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/TestScripts/testBazelReporter.py b/tests/TestScripts/testBazelReporter.py index 62600a39..f91e7b0f 100644 --- a/tests/TestScripts/testBazelReporter.py +++ b/tests/TestScripts/testBazelReporter.py @@ -56,7 +56,14 @@ if ret.returncode != 42: exit(1) try: - tree = ET.parse(xml_out_path) + with open(xml_out_path, 'r', encoding='utf-8') as report: + text = report.read() + # A JUnit report has no document type, so it declares no entities: one + # that does is rejected before parsing, and no entity is ever expanded. + if '<!DOCTYPE' in text or '<!ENTITY' in text: + print("The report declares a document type: '{}'".format(xml_out_path)) + exit(2) + tree = ET.ElementTree(ET.fromstring(text)) except ET.ParseError as ex: print("Invalid XML: '{}'".format(ex)) raise |