44Security
55========
66
7- TODO
8- ^^^^
7+ Prevent decompression bomb when parsing PDF
8+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
99
10- TODO
10+ When parsing a PDF, ``PdfStream.decode() `` attempts to decompress data without any
11+ limit. A default maximum of ``ImageFile.SAFEBLOCK `` has been added. ``PdfParser `` was
12+ added in Pillow 5.1.0. Reported by `redyank <https://github.com/redyank >`__.
1113
12- :cve: `YYYY-XXXXX `: TODO
14+ :cve: `2026-55798 `: WindowsViewer.get_command injection
15+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
17+ If an attacker has control over the path passed to
18+ ``ImageShow.WindowsViewer.get_command() ``, and the result is executed by the user, the
19+ attacker may be able to execute arbitrary shell commands. Reported by Bin Luo,
20+ University of Electronic Science and Technology of China (luob87709@gmail.com).
21+
22+ EPS image infinite loop
1323^^^^^^^^^^^^^^^^^^^^^^^
1424
15- TODO
25+ If a negative byte count is specified for the BeginBinary byte count, an infinite loop
26+ is possible as Pillow seeks repeatedly backwards. This value will now be validated.
27+ BeginBinary parsing was only added in Pillow 12.0.0. Reported by
28+ `jiagongzheng-stack <https://github.com/jiagongzheng-stack >`__.
29+
30+ JPEG2000 image memory usage
31+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
32+
33+ The total component width was incorrectly accumulated across tiles within a JPEG2000
34+ image, potentially leading to excessive memory use. This was introduced as part of an
35+ earlier security fix in Pillow 8.2.0, but has now been fixed. Reported by Fr3v1.
36+
37+ McIdas out-of-bounds (OOB) read
38+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39+
40+ McIdas images can specify the stride, and if incorrectly set, may cause an OOB read.
41+ This has been fixed. Reported by Devansh Shah, RUDRA Cybersecurity Pvt. Ltd.
1642
17- Backwards incompatible changes
18- ==============================
43+ Out-of-bounds (OOB) read when saving 1 mode TGA images
44+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1945
20- TODO
21- ^^^^
46+ Saving 1 mode images as TGA with run-length encoding can trigger an OOB read. This was
47+ added in Pillow 5.2.0, but the functionality is not possible under the TGA
48+ specification, so it has been removed. Reported by
49+ `Seratov <https://github.com/Seratov >`__.
2250
23- TODO
51+ Out-of-bounds (OOB) write from large RankFilter sizes
52+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53+
54+ :py:class: `~PIL.ImageFilter.RankFilter `, and its subclasses, can potentially write
55+ out-of-bounds if given a large size. This has been fixed. Reported by
56+ `Seratov <https://github.com/Seratov >`__.
57+
58+ Out-of-bounds (OOB) write from ``Image.paste() ``
59+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2460
25- Deprecations
26- ============
61+ Large paste box dimensions can cause an OOB write in ``Image.crop() ``,
62+ ``Image.paste() `` and ``Image.alpha_composite() ``. This has been fixed. Reported by
63+ `Seratov <https://github.com/Seratov >`__.
2764
28- TODO
29- ^^^^
65+ Out-of-bounds (OOB) write in `` ImageCmsTransform ``
66+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3067
31- TODO
68+ Apply a transform mode to a different image mode can trigger an OOB write in
69+ ``ImageCmsTransform ``. Errors are now raised if the mode does not match. Reported by
70+ `Seratov <https://github.com/Seratov >`__.
3271
33- API changes
34- ===========
72+ :cve: ` 2026-54059 `, :cve: ` 2026-54060 `, :cve: ` 2026-55379 `: Prevent FontFile decompression bomb
73+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3574
36- TODO
37- ^^^^
75+ Decompression bomb checks have now been added to :py:class: `~PIL.FontFile.FontFile `,
76+ and its subclasses, checking the width and height of characters. Reported by Rahul
77+ Singh and Dinesh.
3878
39- TODO
79+ :cve: `2026-55380 `: Prevent GD decompression bomb
80+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
81+
82+ A decompression bomb check has been added to :py:class: `~PIL.GdImageFile.GdImageFile `.
83+ This is format must be explicitly called though, rather than being accessible from
84+ ``Image.open() ``. Reported by Rahul Singh.
4085
4186API additions
4287=============
@@ -51,6 +96,12 @@ default, images will be captured at 2x. If ``scale_down`` is ``True``, they will
5196
5297Previously, macOS screenshots with a ``bbox `` were captured at 1x by default.
5398
99+ Added ``max_length `` argument to ``PdfStream.decode() ``
100+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101+
102+ When calling ``PdfStream.decode() ``, the maximum length of data to decode can now be
103+ specified. This will default to ``ImageFile.SAFEBLOCK ``.
104+
54105Other changes
55106=============
56107
0 commit comments