mirror of https://github.com/google/oss-fuzz.git
pyyaml: extend to fuzz emitter (#8414)
This commit is contained in:
parent
245789e8d5
commit
7a6671e016
|
@ -27,9 +27,21 @@ def TestOneInput(input_bytes):
|
||||||
try:
|
try:
|
||||||
context = yaml.load(input_bytes, Loader=yaml.FullLoader)
|
context = yaml.load(input_bytes, Loader=yaml.FullLoader)
|
||||||
except yaml.YAMLError:
|
except yaml.YAMLError:
|
||||||
pass
|
return
|
||||||
except RecursionError:
|
except RecursionError:
|
||||||
pass
|
return
|
||||||
|
# Anything that is loadable should be emitable.
|
||||||
|
try:
|
||||||
|
listed_context = list(context)
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
yaml.emit(listed_context)
|
||||||
|
except yaml.emitter.EmitterError:
|
||||||
|
return
|
||||||
|
except RecursionError:
|
||||||
|
return
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)
|
atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)
|
||||||
|
|
Loading…
Reference in New Issue