def test_fuzz_images(path): fuzzers.enable_decompressionbomb_error() try: with open(path, "rb") as f: fuzzers.fuzz_image(f.read()) assert True except ( OSError, SyntaxError, MemoryError, ValueError, NotImplementedError, OverflowError, ): # Known exceptions that are through from Pillow assert True except ( Image.DecompressionBombError, Image.DecompressionBombWarning, Image.UnidentifiedImageError, ): # Known Image.* exceptions assert True finally: fuzzers.disable_decompressionbomb_error()
def main(): fuzzers.enable_decompressionbomb_error() atheris.Setup(sys.argv, TestOneInput) atheris.Fuzz() fuzzers.disable_decompressionbomb_error()
def main(): fuzzers.enable_decompressionbomb_error() atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True) atheris.Fuzz()