diff --git a/Makefile b/Makefile index 6e050c715d2..db48e83f5db 100644 --- a/Makefile +++ b/Makefile @@ -106,14 +106,14 @@ test-p: .PHONY: valgrind valgrind: python3 -c "import pytest_valgrind" > /dev/null 2>&1 || python3 -m pip install pytest-valgrind - PILLOW_VALGRIND_TEST=true PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp --leak-check=no \ + PILLOW_VALGRIND_TEST=true PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss_fuzz/python.supp --leak-check=no \ --log-file=/tmp/valgrind-output \ python3 -m pytest --no-memcheck -vv --valgrind --valgrind-log=/tmp/valgrind-output .PHONY: valgrind-leak valgrind-leak: python3 -c "import pytest_valgrind" > /dev/null 2>&1 || python3 -m pip install pytest-valgrind - PILLOW_VALGRIND_TEST=true PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp \ + PILLOW_VALGRIND_TEST=true PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss_fuzz/python.supp \ --leak-check=full --show-leak-kinds=definite --errors-for-leak-kinds=definite \ --log-file=/tmp/valgrind-output \ python3 -m pytest -vv --valgrind --valgrind-log=/tmp/valgrind-output diff --git a/Tests/oss-fuzz/build.sh b/Tests/oss_fuzz/build.sh similarity index 100% rename from Tests/oss-fuzz/build.sh rename to Tests/oss_fuzz/build.sh diff --git a/Tests/oss-fuzz/build_dictionaries.sh b/Tests/oss_fuzz/build_dictionaries.sh similarity index 100% rename from Tests/oss-fuzz/build_dictionaries.sh rename to Tests/oss_fuzz/build_dictionaries.sh diff --git a/Tests/oss-fuzz/fuzz_font.py b/Tests/oss_fuzz/fuzz_font.py similarity index 100% rename from Tests/oss-fuzz/fuzz_font.py rename to Tests/oss_fuzz/fuzz_font.py diff --git a/Tests/oss-fuzz/fuzz_pillow.py b/Tests/oss_fuzz/fuzz_pillow.py similarity index 100% rename from Tests/oss-fuzz/fuzz_pillow.py rename to Tests/oss_fuzz/fuzz_pillow.py diff --git a/Tests/oss-fuzz/fuzzers.py b/Tests/oss_fuzz/fuzzers.py similarity index 100% rename from Tests/oss-fuzz/fuzzers.py rename to Tests/oss_fuzz/fuzzers.py diff --git a/Tests/oss-fuzz/python.supp b/Tests/oss_fuzz/python.supp similarity index 100% rename from Tests/oss-fuzz/python.supp rename to Tests/oss_fuzz/python.supp diff --git a/Tests/oss-fuzz/test_fuzzers.py b/Tests/oss_fuzz/test_fuzzers.py similarity index 100% rename from Tests/oss-fuzz/test_fuzzers.py rename to Tests/oss_fuzz/test_fuzzers.py diff --git a/Tests/test_font_crash.py b/Tests/test_font_crash.py index fb5026ee0ef..56147bb6706 100644 --- a/Tests/test_font_crash.py +++ b/Tests/test_font_crash.py @@ -2,19 +2,13 @@ import pytest -from PIL import ImageFont - from .helper import skip_unless_feature +from .oss_fuzz.fuzzers import fuzz_font class TestFontCrash: - def _fuzz_font(self, font: ImageFont.FreeTypeFont) -> None: - # from fuzzers.fuzz_font - font.getbbox("ABC") - font.getmask("test text") - @skip_unless_feature("freetype2") def test_segfault(self) -> None: - with pytest.raises(OSError): - font = ImageFont.truetype("Tests/fonts/fuzz_font-5203009437302784") - self._fuzz_font(font) + with open("Tests/fonts/fuzz_font-5203009437302784", "rb") as fp: + with pytest.raises(OSError): + fuzz_font(fp.read()) diff --git a/pyproject.toml b/pyproject.toml index 137726a1c04..8b7a7324c7d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -188,10 +188,10 @@ lint.ignore = [ "PYI034", # flake8-pyi: typing.Self added in Python 3.11 "UP038", # pyupgrade: deprecated rule ] -lint.per-file-ignores."Tests/oss-fuzz/fuzz_font.py" = [ +lint.per-file-ignores."Tests/oss_fuzz/fuzz_font.py" = [ "I002", ] -lint.per-file-ignores."Tests/oss-fuzz/fuzz_pillow.py" = [ +lint.per-file-ignores."Tests/oss_fuzz/fuzz_pillow.py" = [ "I002", ] lint.flake8-pytest-style.parametrize-names-type = "csv"