From de098f51a630bb506a5c1ed2eeef53c7735ad5b5 Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Fri, 12 Aug 2022 09:51:01 +0100 Subject: [PATCH] pyyaml: catch recursion exceptions (#8227) Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50061 --- projects/pyyaml/fuzz_loader.py | 2 ++ projects/pyyaml/fuzz_reader.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/projects/pyyaml/fuzz_loader.py b/projects/pyyaml/fuzz_loader.py index 40c9fcc56..4077eea71 100644 --- a/projects/pyyaml/fuzz_loader.py +++ b/projects/pyyaml/fuzz_loader.py @@ -28,6 +28,8 @@ def TestOneInput(input_bytes): context = yaml.load(input_bytes, Loader=yaml.FullLoader) except yaml.YAMLError: pass + except RecursionError: + pass def main(): atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True) diff --git a/projects/pyyaml/fuzz_reader.py b/projects/pyyaml/fuzz_reader.py index 5cd0d1e86..eb8928ce9 100644 --- a/projects/pyyaml/fuzz_reader.py +++ b/projects/pyyaml/fuzz_reader.py @@ -28,6 +28,8 @@ def TestOneInput(data): stream.forward() except yaml.reader.ReaderError: None + except RecursionError: + pass return