Reset fuzzer LOAD_TRUNCATED_IMAGES and filters to allow for random test order

This commit is contained in:
Andrew Murray 2021-06-10 13:49:17 +10:00
parent d99a6ff862
commit 41fc39174a
4 changed files with 9 additions and 0 deletions

View File

@ -34,6 +34,7 @@ def main():
fuzzers.enable_decompressionbomb_error()
atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)
atheris.Fuzz()
fuzzers.disable_decompressionbomb_error()
if __name__ == "__main__":

View File

@ -34,6 +34,7 @@ def main():
fuzzers.enable_decompressionbomb_error()
atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)
atheris.Fuzz()
fuzzers.disable_decompressionbomb_error()
if __name__ == "__main__":

View File

@ -10,6 +10,11 @@ def enable_decompressionbomb_error():
warnings.simplefilter("error", Image.DecompressionBombWarning)
def disable_decompressionbomb_error():
ImageFile.LOAD_TRUNCATED_IMAGES = False
warnings.resetwarnings()
def fuzz_image(data):
# This will fail on some images in the corpus, as we have many
# invalid images in the test suite.

View File

@ -44,6 +44,8 @@ def test_fuzz_images(path):
):
# Known Image.* exceptions
assert True
finally:
fuzzers.disable_decompressionbomb_error()
@pytest.mark.parametrize(