Skip to content

Commit 17c7bef

Browse files
authored
Merge branch 'main' into harfbuzz
2 parents d6b9442 + 8e8b94a commit 17c7bef

File tree

10 files changed

+30
-24
lines changed

10 files changed

+30
-24
lines changed

.ci/requirements-cibw.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cibuildwheel==2.22.0
1+
cibuildwheel==2.23.0

.github/workflows/test-mingw.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
mingw-w64-x86_64-gcc \
6161
mingw-w64-x86_64-ghostscript \
6262
mingw-w64-x86_64-lcms2 \
63+
mingw-w64-x86_64-libimagequant \
6364
mingw-w64-x86_64-libjpeg-turbo \
6465
mingw-w64-x86_64-libraqm \
6566
mingw-w64-x86_64-libtiff \

.github/workflows/wheels-dependencies.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ ARCHIVE_SDIR=pillow-depends-main
3939
# Package versions for fresh source builds
4040
FREETYPE_VERSION=2.13.3
4141
HARFBUZZ_VERSION=10.4.0
42-
LIBPNG_VERSION=1.6.46
42+
LIBPNG_VERSION=1.6.47
4343
JPEGTURBO_VERSION=3.1.0
4444
OPENJPEG_VERSION=2.5.3
4545
XZ_VERSION=5.6.4
4646
TIFF_VERSION=4.6.0
47-
LCMS2_VERSION=2.16
47+
LCMS2_VERSION=2.17
4848
ZLIB_NG_VERSION=2.2.4
4949
LIBWEBP_VERSION=1.5.0
5050
BZIP2_VERSION=1.0.8

.github/workflows/wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: "macOS 10.15 x86_64"
6464
os: macos-13
6565
cibw_arch: x86_64
66-
build: "pp310*"
66+
build: "pp3*"
6767
macosx_deployment_target: "10.15"
6868
- name: "macOS arm64"
6969
os: macos-latest

Tests/test_file_ftex.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from __future__ import annotations
22

3+
import io
4+
import struct
5+
36
import pytest
47

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

2427
with pytest.raises(SyntaxError):
2528
FtexImagePlugin.FtexImageFile(invalid_file)
29+
30+
31+
def test_invalid_texture() -> None:
32+
with open("Tests/images/ftex_dxt1.ftc", "rb") as fp:
33+
data = fp.read()
34+
35+
# Change texture compression format
36+
data = data[:24] + struct.pack("<i", 2) + data[28:]
37+
38+
with pytest.raises(ValueError, match="Invalid texture compression format: 2"):
39+
with Image.open(io.BytesIO(data)):
40+
pass

docs/installation/building-from-source.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Many of Pillow's features require external libraries:
5151
* **littlecms** provides color management
5252

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

5656
* **libwebp** provides the WebP format.
5757

src/PIL/FtexImagePlugin.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ def _open(self) -> None:
7979
self._size = struct.unpack("<2i", self.fp.read(8))
8080
mipmap_count, format_count = struct.unpack("<2i", self.fp.read(8))
8181

82-
self._mode = "RGB"
83-
8482
# Only support single-format files.
8583
# I don't know of any multi-format file.
8684
assert format_count == 1
@@ -95,6 +93,7 @@ def _open(self) -> None:
9593
self._mode = "RGBA"
9694
self.tile = [ImageFile._Tile("bcn", (0, 0) + self.size, 0, (1,))]
9795
elif format == Format.UNCOMPRESSED:
96+
self._mode = "RGB"
9897
self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, "RGB")]
9998
else:
10099
msg = f"Invalid texture compression format: {repr(format)}"

src/PIL/MicImagePlugin.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,7 @@ def _open(self) -> None:
7373
def seek(self, frame: int) -> None:
7474
if not self._seek_check(frame):
7575
return
76-
try:
77-
filename = self.images[frame]
78-
except IndexError as e:
79-
msg = "no such frame"
80-
raise EOFError(msg) from e
81-
76+
filename = self.images[frame]
8277
self.fp = self.ole.openstream(filename)
8378

8479
TiffImagePlugin.TiffImageFile._open(self)

src/PIL/PsdImagePlugin.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,11 @@ def seek(self, layer: int) -> None:
169169
return
170170

171171
# seek to given layer (1..max)
172-
try:
173-
_, mode, _, tile = self.layers[layer - 1]
174-
self._mode = mode
175-
self.tile = tile
176-
self.frame = layer
177-
self.fp = self._fp
178-
except IndexError as e:
179-
msg = "no such layer"
180-
raise EOFError(msg) from e
172+
_, mode, _, tile = self.layers[layer - 1]
173+
self._mode = mode
174+
self.tile = tile
175+
self.frame = layer
176+
self.fp = self._fp
181177

182178
def tell(self) -> int:
183179
# return layer number (0=image, 1..max=layers)

winbuild/build_prepare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ def cmd_msbuild(
115115
"FRIBIDI": "1.0.16",
116116
"HARFBUZZ": "10.4.0",
117117
"JPEGTURBO": "3.1.0",
118-
"LCMS2": "2.16",
118+
"LCMS2": "2.17",
119119
"LIBIMAGEQUANT": "4.3.4",
120-
"LIBPNG": "1.6.46",
120+
"LIBPNG": "1.6.47",
121121
"LIBWEBP": "1.5.0",
122122
"OPENJPEG": "2.5.3",
123123
"TIFF": "4.6.0",

0 commit comments

Comments
 (0)