pyyaml: extend to fuzz emitter (#8414)

This commit is contained in:
DavidKorczynski 2022-09-05 14:37:16 +01:00 committed by GitHub
parent 245789e8d5
commit 7a6671e016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 2 deletions

View File

@ -27,9 +27,21 @@ def TestOneInput(input_bytes):
try:
context = yaml.load(input_bytes, Loader=yaml.FullLoader)
except yaml.YAMLError:
pass
return
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():
atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)