Skip to content

Commit 97673f4

Browse files
authored
Merge branch 'python-pillow:main' into usepcf
2 parents 57be9dc + 1457c60 commit 97673f4

12 files changed

Lines changed: 58 additions & 6 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ concurrency:
2929
env:
3030
COVERAGE_CORE: sysmon
3131
FORCE_COLOR: 1
32+
PIP_DISABLE_PIP_VERSION_CHECK: 1
3233

3334
jobs:
3435
build:

Tests/images/psd-oob-write-x.psd

1.1 KB
Binary file not shown.

Tests/images/psd-oob-write-y.psd

1.1 KB
Binary file not shown.

Tests/images/psd-oob-write.psd

36.3 KB
Binary file not shown.

Tests/test_file_psd.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,20 @@ def test_layer_crashes(test_file: str) -> None:
182182
assert isinstance(im, PsdImagePlugin.PsdImageFile)
183183
with pytest.raises(SyntaxError):
184184
im.layers
185+
186+
187+
@pytest.mark.parametrize(
188+
"test_file",
189+
[
190+
"Tests/images/psd-oob-write.psd",
191+
"Tests/images/psd-oob-write-x.psd",
192+
"Tests/images/psd-oob-write-y.psd",
193+
],
194+
)
195+
def test_bounds_crash(test_file: str) -> None:
196+
with Image.open(test_file) as im:
197+
assert isinstance(im, PsdImagePlugin.PsdImageFile)
198+
im.seek(im.n_frames)
199+
200+
with pytest.raises(ValueError):
201+
im.load()

Tests/test_imagefile.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@ def test_negative_offset(self) -> None:
163163
with pytest.raises(ValueError, match="Tile offset cannot be negative"):
164164
im.load()
165165

166+
@pytest.mark.parametrize("xy", ((-1, 0), (0, -1)))
167+
def test_negative_tile_extents(self, xy: tuple[int, int]) -> None:
168+
im = Image.new("1", (1, 1))
169+
fp = BytesIO()
170+
with pytest.raises(SystemError, match="tile cannot extend outside image"):
171+
ImageFile._save(im, fp, [ImageFile._Tile("raw", xy + (1, 1), 0, "1")])
172+
166173
def test_no_format(self) -> None:
167174
buf = BytesIO(b"\x00" * 255)
168175

docs/installation/platform-support.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ These platforms have been reported to work at the versions mentioned.
7575
| Operating system | | Tested Python | | Latest tested | | Tested |
7676
| | | versions | | Pillow version | | processors |
7777
+==================================+=============================+==================+==============+
78-
| macOS 26 Tahoe | 3.10, 3.11, 3.12, 3.13, 3.14| 12.0.0 |arm |
78+
| macOS 26 Tahoe | 3.10, 3.11, 3.12, 3.13, 3.14| 12.1.1 |arm |
7979
| +-----------------------------+------------------+ |
8080
| | 3.9 | 11.3.0 | |
8181
+----------------------------------+-----------------------------+------------------+--------------+

docs/releasenotes/12.1.1.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
12.1.1
2+
------
3+
4+
Security
5+
========
6+
7+
:cve:`2026-25990`: Fix OOB write with invalid tile extents
8+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9+
10+
Check that tile extents do not use negative x or y offsets when decoding or encoding,
11+
and raise an error if they do, rather than allowing an OOB write.
12+
13+
An out-of-bounds write may be triggered when opening a specially crafted PSD image.
14+
This only affects Pillow >= 10.3.0. Reported by
15+
`Yarden Porat <https://github.com/yardenporat353>`__.
16+
17+
Other changes
18+
=============
19+
20+
Patch libavif for svt-av1 4.0 compatibility
21+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22+
23+
A patch has been added to ``depends/install_libavif.sh``, to allow libavif 1.3.0 to be
24+
compatible with the recently released svt-av1 4.0.0.

docs/releasenotes/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ expected to be backported to earlier versions.
1515
:maxdepth: 2
1616

1717
versioning
18+
12.1.1
1819
12.1.0
1920
12.0.0
2021
11.3.0

src/PIL/PalmImagePlugin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
210210
#
211211
# --------------------------------------------------------------------
212212

213-
Image.register_save("Palm", _save)
213+
Image.register_save("PALM", _save)
214214

215-
Image.register_extension("Palm", ".palm")
215+
Image.register_extension("PALM", ".palm")
216216

217-
Image.register_mime("Palm", "image/palm")
217+
Image.register_mime("PALM", "image/palm")

0 commit comments

Comments
 (0)