mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-09-24 21:17:02 +03:00
Import fuzz_font from oss_fuzz directory
This commit is contained in:
parent
c58bf5309f
commit
8b4a716582
|
@ -2,19 +2,13 @@ from __future__ import annotations
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from PIL import ImageFont
|
|
||||||
|
|
||||||
from .helper import skip_unless_feature
|
from .helper import skip_unless_feature
|
||||||
|
from .oss_fuzz.fuzzers import fuzz_font
|
||||||
|
|
||||||
|
|
||||||
class TestFontCrash:
|
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")
|
@skip_unless_feature("freetype2")
|
||||||
def test_segfault(self) -> None:
|
def test_segfault(self) -> None:
|
||||||
|
with open("Tests/fonts/fuzz_font-5203009437302784", "rb") as fp:
|
||||||
with pytest.raises(OSError):
|
with pytest.raises(OSError):
|
||||||
font = ImageFont.truetype("Tests/fonts/fuzz_font-5203009437302784")
|
fuzz_font(fp.read())
|
||||||
self._fuzz_font(font)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user