[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-02-10 22:04:56 +00:00
parent c8d0e9595e
commit ea1919dadf
2 changed files with 29 additions and 6 deletions

View File

@ -13,7 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import annotations
import atheris import atheris
@ -22,10 +22,31 @@ with atheris.instrument_imports():
import fuzzers import fuzzers
MODES = ["1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "LAB", MODES = [
"HSV", "I", "F", "LA", "PA", "RGBX", "RGBa", "La", "I;16", "1",
"I;16L", "I;16B", "I;16N", "BGR;15", "BGR;16", "BGR;24", "L",
] "P",
"RGB",
"RGBA",
"CMYK",
"YCbCr",
"LAB",
"HSV",
"I",
"F",
"LA",
"PA",
"RGBX",
"RGBa",
"La",
"I;16",
"I;16L",
"I;16B",
"I;16N",
"BGR;15",
"BGR;16",
"BGR;24",
]
def TestOneInput(data: bytes) -> None: def TestOneInput(data: bytes) -> None:

View File

@ -3,7 +3,7 @@ from __future__ import annotations
import io import io
import warnings import warnings
from PIL import Image, ImageDraw, ImageFile, ImageFilter, ImageFont, ImageCms from PIL import Image, ImageCms, ImageDraw, ImageFile, ImageFilter, ImageFont
def enable_decompressionbomb_error() -> None: def enable_decompressionbomb_error() -> None:
@ -25,11 +25,13 @@ def fuzz_image(data: bytes) -> None:
im.filter(ImageFilter.DETAIL) im.filter(ImageFilter.DETAIL)
im.save(io.BytesIO(), "BMP") im.save(io.BytesIO(), "BMP")
def fuzz_cms(profile1, profile2, trans1, trans2) -> None: def fuzz_cms(profile1, profile2, trans1, trans2) -> None:
p1 = ImageCms.createProfile(profile1) p1 = ImageCms.createProfile(profile1)
p2 = ImageCms.createProfile(profile2) p2 = ImageCms.createProfile(profile2)
t = ImageCms.buildTransform(p1, p2, trans1, trans2) t = ImageCms.buildTransform(p1, p2, trans1, trans2)
def fuzz_font(data: bytes) -> None: def fuzz_font(data: bytes) -> None:
wrapper = io.BytesIO(data) wrapper = io.BytesIO(data)
try: try: