aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar DavidKorczynski <david@adalogics.com>2022-04-13 10:21:35 +0100
committerGravatar GitHub <noreply@github.com>2022-04-13 10:21:35 +0100
commitbc05619b4c762d502e7d35557bdd4d1b1670bc80 (patch)
treed86657b9eda047712e6ac7d5cb262f52812c64db
parent4f932b199b903ddd614b9e7f4a22caaefeaf686a (diff)
lxml: fix fuzz_xml_parse (#7565)
-rw-r--r--projects/lxml/fuzz_xml_parse.py12
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)