mirror of https://github.com/google/oss-fuzz.git
lxml: fix fuzz_xml_parse (#7565)
This commit is contained in:
parent
4f932b199b
commit
bc05619b4c
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue