Skip to content

Commit

Permalink
Merge branch 'main' into harfbuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Mar 3, 2025
2 parents d6b9442 + 8e8b94a commit 17c7bef
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .ci/requirements-cibw.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cibuildwheel==2.22.0
cibuildwheel==2.23.0
1 change: 1 addition & 0 deletions .github/workflows/test-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
mingw-w64-x86_64-gcc \
mingw-w64-x86_64-ghostscript \
mingw-w64-x86_64-lcms2 \
mingw-w64-x86_64-libimagequant \
mingw-w64-x86_64-libjpeg-turbo \
mingw-w64-x86_64-libraqm \
mingw-w64-x86_64-libtiff \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/wheels-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ ARCHIVE_SDIR=pillow-depends-main
# Package versions for fresh source builds
FREETYPE_VERSION=2.13.3
HARFBUZZ_VERSION=10.4.0
LIBPNG_VERSION=1.6.46
LIBPNG_VERSION=1.6.47
JPEGTURBO_VERSION=3.1.0
OPENJPEG_VERSION=2.5.3
XZ_VERSION=5.6.4
TIFF_VERSION=4.6.0
LCMS2_VERSION=2.16
LCMS2_VERSION=2.17
ZLIB_NG_VERSION=2.2.4
LIBWEBP_VERSION=1.5.0
BZIP2_VERSION=1.0.8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: "macOS 10.15 x86_64"
os: macos-13
cibw_arch: x86_64
build: "pp310*"
build: "pp3*"
macosx_deployment_target: "10.15"
- name: "macOS arm64"
os: macos-latest
Expand Down
15 changes: 15 additions & 0 deletions Tests/test_file_ftex.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from __future__ import annotations

import io
import struct

import pytest

from PIL import FtexImagePlugin, Image
Expand All @@ -23,3 +26,15 @@ def test_invalid_file() -> None:

with pytest.raises(SyntaxError):
FtexImagePlugin.FtexImageFile(invalid_file)


def test_invalid_texture() -> None:
with open("Tests/images/ftex_dxt1.ftc", "rb") as fp:
data = fp.read()

# Change texture compression format
data = data[:24] + struct.pack("<i", 2) + data[28:]

with pytest.raises(ValueError, match="Invalid texture compression format: 2"):
with Image.open(io.BytesIO(data)):
pass
2 changes: 1 addition & 1 deletion docs/installation/building-from-source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Many of Pillow's features require external libraries:
* **littlecms** provides color management

* Pillow version 2.2.1 and below uses liblcms1, Pillow 2.3.0 and
above uses liblcms2. Tested with **1.19** and **2.7-2.16**.
above uses liblcms2. Tested with **1.19** and **2.7-2.17**.

* **libwebp** provides the WebP format.

Expand Down
3 changes: 1 addition & 2 deletions src/PIL/FtexImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ def _open(self) -> None:
self._size = struct.unpack("<2i", self.fp.read(8))
mipmap_count, format_count = struct.unpack("<2i", self.fp.read(8))

self._mode = "RGB"

# Only support single-format files.
# I don't know of any multi-format file.
assert format_count == 1
Expand All @@ -95,6 +93,7 @@ def _open(self) -> None:
self._mode = "RGBA"
self.tile = [ImageFile._Tile("bcn", (0, 0) + self.size, 0, (1,))]
elif format == Format.UNCOMPRESSED:
self._mode = "RGB"
self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, "RGB")]
else:
msg = f"Invalid texture compression format: {repr(format)}"
Expand Down
7 changes: 1 addition & 6 deletions src/PIL/MicImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@ def _open(self) -> None:
def seek(self, frame: int) -> None:
if not self._seek_check(frame):
return
try:
filename = self.images[frame]
except IndexError as e:
msg = "no such frame"
raise EOFError(msg) from e

filename = self.images[frame]
self.fp = self.ole.openstream(filename)

TiffImagePlugin.TiffImageFile._open(self)
Expand Down
14 changes: 5 additions & 9 deletions src/PIL/PsdImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,11 @@ def seek(self, layer: int) -> None:
return

# seek to given layer (1..max)
try:
_, mode, _, tile = self.layers[layer - 1]
self._mode = mode
self.tile = tile
self.frame = layer
self.fp = self._fp
except IndexError as e:
msg = "no such layer"
raise EOFError(msg) from e
_, mode, _, tile = self.layers[layer - 1]
self._mode = mode
self.tile = tile
self.frame = layer
self.fp = self._fp

def tell(self) -> int:
# return layer number (0=image, 1..max=layers)
Expand Down
4 changes: 2 additions & 2 deletions winbuild/build_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ def cmd_msbuild(
"FRIBIDI": "1.0.16",
"HARFBUZZ": "10.4.0",
"JPEGTURBO": "3.1.0",
"LCMS2": "2.16",
"LCMS2": "2.17",
"LIBIMAGEQUANT": "4.3.4",
"LIBPNG": "1.6.46",
"LIBPNG": "1.6.47",
"LIBWEBP": "1.5.0",
"OPENJPEG": "2.5.3",
"TIFF": "4.6.0",
Expand Down

0 comments on commit 17c7bef

Please sign in to comment.