From 9d4814356700e166ff0ceeb8cb713d23fc231b93 Mon Sep 17 00:00:00 2001 From: Julien Voisin Date: Wed, 25 Aug 2021 16:45:39 +0200 Subject: [PATCH 1/2] Improve the fuzzer wrt. the current atheris version --- Tests/oss-fuzz/fuzz_font.py | 12 ++++++------ Tests/oss-fuzz/fuzz_pillow.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Tests/oss-fuzz/fuzz_font.py b/Tests/oss-fuzz/fuzz_font.py index e11471011..0cc4a99ef 100755 --- a/Tests/oss-fuzz/fuzz_font.py +++ b/Tests/oss-fuzz/fuzz_font.py @@ -14,10 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys -import atheris_no_libfuzzer as atheris -import fuzzers +import atheris +with atheris.instrument_imports(): + import sys + import fuzzers def TestOneInput(data): @@ -26,13 +27,12 @@ def TestOneInput(data): except Exception: # We're catching all exceptions because Pillow's exceptions are # directly inheriting from Exception. - return - return + pass def main(): fuzzers.enable_decompressionbomb_error() - atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True) + atheris.Setup(sys.argv, TestOneInput) atheris.Fuzz() fuzzers.disable_decompressionbomb_error() diff --git a/Tests/oss-fuzz/fuzz_pillow.py b/Tests/oss-fuzz/fuzz_pillow.py index b3c55fe22..3dd1aea0d 100644 --- a/Tests/oss-fuzz/fuzz_pillow.py +++ b/Tests/oss-fuzz/fuzz_pillow.py @@ -14,10 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys -import atheris_no_libfuzzer as atheris -import fuzzers +import atheris +with atheris.instrument_imports(): + import sys + import fuzzers def TestOneInput(data): @@ -26,13 +27,12 @@ def TestOneInput(data): except Exception: # We're catching all exceptions because Pillow's exceptions are # directly inheriting from Exception. - return - return + pass def main(): fuzzers.enable_decompressionbomb_error() - atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True) + atheris.Setup(sys.argv, TestOneInput) atheris.Fuzz() fuzzers.disable_decompressionbomb_error() From 3b69035d4b36af359917136c6dde2d953be5a332 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 14:52:16 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- Tests/oss-fuzz/fuzz_font.py | 2 ++ Tests/oss-fuzz/fuzz_pillow.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Tests/oss-fuzz/fuzz_font.py b/Tests/oss-fuzz/fuzz_font.py index 0cc4a99ef..bc2ba9a7e 100755 --- a/Tests/oss-fuzz/fuzz_font.py +++ b/Tests/oss-fuzz/fuzz_font.py @@ -16,8 +16,10 @@ import atheris + with atheris.instrument_imports(): import sys + import fuzzers diff --git a/Tests/oss-fuzz/fuzz_pillow.py b/Tests/oss-fuzz/fuzz_pillow.py index 3dd1aea0d..545daccb6 100644 --- a/Tests/oss-fuzz/fuzz_pillow.py +++ b/Tests/oss-fuzz/fuzz_pillow.py @@ -16,8 +16,10 @@ import atheris + with atheris.instrument_imports(): import sys + import fuzzers