diff options
author | DavidKorczynski <david@adalogics.com> | 2022-04-13 10:21:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-13 10:21:35 +0100 |
commit | bc05619b4c762d502e7d35557bdd4d1b1670bc80 (patch) | |
tree | d86657b9eda047712e6ac7d5cb262f52812c64db | |
parent | 4f932b199b903ddd614b9e7f4a22caaefeaf686a (diff) |
lxml: fix fuzz_xml_parse (#7565)
-rw-r--r-- | projects/lxml/fuzz_xml_parse.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/projects/lxml/fuzz_xml_parse.py b/projects/lxml/fuzz_xml_parse.py index ecf90883..e5e616b0 100644 --- a/projects/lxml/fuzz_xml_parse.py +++ b/projects/lxml/fuzz_xml_parse.py @@ -22,17 +22,25 @@ with atheris.instrument_imports(): def TestOneInput(data): + tree = None + success = False try: root = et.XML(data) if root != None: et.indent(root) tree = et.ElementTree(root) - a = et.Element("a") - tree.getelementpath(a) + success = True except et.XMLSyntaxError: None + if success: + try: + a = et.Element("a") + tree.getelementpath(a) + except ValueError: + None + def main(): atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True) |