Skip to content

Commit 04f60eb

Browse files
committed
Clean up for #7864
Before back fill, clean up. - Add suggested CVE format to template - Move Security to the top of release notes - Fix headings - Update all existing CVE notes to match template
1 parent 786ded0 commit 04f60eb

20 files changed

+571
-307
lines changed

docs/releasenotes/10.0.0.rst

+29-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
11
10.0.0
22
------
33

4+
Security
5+
========
6+
7+
Limit size even if one dimension is zero
8+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9+
10+
When performing decompression bomb checks, Pillow did not reject images with
11+
excessive width and zero height, or zero width and excessive height. That has
12+
now been fixed.
13+
14+
This effectively dates to the PIL fork, since problem images would still have
15+
been processed before Pillow started checking for decompression bombs.
16+
17+
Fix CVE-2023-44271
18+
^^^^^^^^^^^^^^^^^^
19+
20+
Added ImageFont.MAX_STRING_LENGTH.
21+
22+
.. note:: More information about this vulnerability included in database record :cve:`2023-44271`
23+
24+
To protect against potential DOS attacks when using arbitrary strings as text
25+
input, Pillow will now raise a :py:exc:`ValueError` if the number of characters
26+
passed into ImageFont methods is over a certain limit,
27+
:py:data:`PIL.ImageFont.MAX_STRING_LENGTH`.
28+
29+
This threshold can be changed by setting
30+
:py:data:`PIL.ImageFont.MAX_STRING_LENGTH`. It can be disabled by setting
31+
``ImageFont.MAX_STRING_LENGTH = None``.
32+
433
Backwards Incompatible Changes
534
==============================
635

@@ -157,31 +186,6 @@ Added ``alpha_only`` argument to ``getbbox()``
157186
and the image has an alpha channel, trim transparent pixels. Otherwise, trim
158187
pixels when all channels are zero.
159188

160-
Security
161-
========
162-
163-
Limit size even if one dimension is zero
164-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
165-
166-
When performing decompression bomb checks, Pillow did not reject images with
167-
excessive width and zero height, or zero width and excessive height. That has
168-
now been fixed.
169-
170-
This effectively dates to the PIL fork, since problem images would still have
171-
been processed before Pillow started checking for decompression bombs.
172-
173-
Added ImageFont.MAX_STRING_LENGTH
174-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
175-
176-
:cve:`2023-44271`: To protect against potential DOS attacks when using arbitrary strings as text
177-
input, Pillow will now raise a :py:exc:`ValueError` if the number of characters
178-
passed into ImageFont methods is over a certain limit,
179-
:py:data:`PIL.ImageFont.MAX_STRING_LENGTH`.
180-
181-
This threshold can be changed by setting
182-
:py:data:`PIL.ImageFont.MAX_STRING_LENGTH`. It can be disabled by setting
183-
``ImageFont.MAX_STRING_LENGTH = None``.
184-
185189
Other Changes
186190
=============
187191

docs/releasenotes/10.0.1.rst

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@
44
Security
55
========
66

7-
This release addresses :cve:`2023-4863`, by providing an updated install script and
8-
updated wheels to include libwebp 1.3.2, preventing a potential heap buffer overflow
9-
in WebP.
7+
Fix CVE-2023-4863
8+
^^^^^^^^^^^^^^^^^
9+
10+
Updated install script and wheels with libwebp 1.3.2
11+
12+
.. note:: More information about this vulnerability included in database record :cve:`2023-4863`
13+
14+
This release provides an updated install script and updated wheels to
15+
include libwebp 1.3.2, preventing a potential heap buffer overflow in WebP.
1016

1117
Updated tests to pass with latest zlib version
1218
==============================================

docs/releasenotes/10.2.0.rst

+36-32
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
11
10.2.0
22
------
33

4+
Security
5+
========
6+
7+
ImageFont.getmask: Applied ImageFont.MAX_STRING_LENGTH
8+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9+
10+
To protect against potential DOS attacks when using arbitrary strings as text input,
11+
Pillow will now raise a :py:exc:`ValueError` if the number of characters passed into
12+
:py:meth:`PIL.ImageFont.ImageFont.getmask` is over a certain limit,
13+
:py:data:`PIL.ImageFont.MAX_STRING_LENGTH`.
14+
15+
This threshold can be changed by setting :py:data:`PIL.ImageFont.MAX_STRING_LENGTH`. It
16+
can be disabled by setting ``ImageFont.MAX_STRING_LENGTH = None``.
17+
18+
A decompression bomb check has also been added to
19+
:py:meth:`PIL.ImageFont.ImageFont.getmask`.
20+
21+
ImageFont.getmask: Trim glyph size
22+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23+
24+
To protect against potential DOS attacks when using PIL fonts,
25+
:py:class:`PIL.ImageFont.ImageFont` now trims the size of individual glyphs so that
26+
they do not extend beyond the bitmap image.
27+
28+
Fix CVE-2023-50447
29+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
ImageMath.eval: Restricted environment keys.
32+
33+
.. note:: More information about this vulnerability included in database record :cve:`2023-50447`
34+
35+
If an attacker has control over the keys passed to the
36+
``environment`` argument of :py:meth:`PIL.ImageMath.eval`, they may be able to execute
37+
arbitrary code. To prevent this, keys matching the names of builtins and keys
38+
containing double underscores will now raise a :py:exc:`ValueError`.
39+
440
Deprecations
541
============
642

@@ -63,38 +99,6 @@ JPEG tables-only streamtype
6399
When saving JPEG files, ``streamtype`` can now be set to 1, for tables-only. This will
64100
output only the quantization and Huffman tables for the image.
65101

66-
Security
67-
========
68-
69-
ImageFont.getmask: Applied ImageFont.MAX_STRING_LENGTH
70-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
71-
72-
To protect against potential DOS attacks when using arbitrary strings as text input,
73-
Pillow will now raise a :py:exc:`ValueError` if the number of characters passed into
74-
:py:meth:`PIL.ImageFont.ImageFont.getmask` is over a certain limit,
75-
:py:data:`PIL.ImageFont.MAX_STRING_LENGTH`.
76-
77-
This threshold can be changed by setting :py:data:`PIL.ImageFont.MAX_STRING_LENGTH`. It
78-
can be disabled by setting ``ImageFont.MAX_STRING_LENGTH = None``.
79-
80-
A decompression bomb check has also been added to
81-
:py:meth:`PIL.ImageFont.ImageFont.getmask`.
82-
83-
ImageFont.getmask: Trim glyph size
84-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
85-
86-
To protect against potential DOS attacks when using PIL fonts,
87-
:py:class:`PIL.ImageFont.ImageFont` now trims the size of individual glyphs so that
88-
they do not extend beyond the bitmap image.
89-
90-
ImageMath.eval: Restricted environment keys
91-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92-
93-
:cve:`2023-50447`: If an attacker has control over the keys passed to the
94-
``environment`` argument of :py:meth:`PIL.ImageMath.eval`, they may be able to execute
95-
arbitrary code. To prevent this, keys matching the names of builtins and keys
96-
containing double underscores will now raise a :py:exc:`ValueError`.
97-
98102
Other Changes
99103
=============
100104

docs/releasenotes/3.1.1.rst

+29-15
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
21
3.1.1
3-
=====
2+
-----
3+
4+
Security
5+
========
6+
7+
Fix CVE-2016-0740
8+
^^^^^^^^^^^^^^^^^
9+
10+
Buffer overflow in TiffDecode.c.
411

5-
CVE-2016-0740 -- Buffer overflow in TiffDecode.c
6-
------------------------------------------------
12+
.. note:: More information about this vulnerability included in database record :cve:`2016-0740`
713

8-
Pillow 3.1.0 and earlier when linked against libtiff >= 4.0.0 on x64
9-
may overflow a buffer when reading a specially crafted tiff file (:cve:`2016-0740`).
14+
Pillow 3.1.0 and earlier when linked against
15+
libtiff >= 4.0.0 on x64 may overflow a buffer when reading a
16+
specially crafted tiff file.
1017

1118
Specifically, libtiff >= 4.0.0 changed the return type of
1219
``TIFFScanlineSize`` from ``int32`` to machine dependent
@@ -19,12 +26,15 @@ image data over 64k is written over the heap, causing a segfault.
1926

2027
This issue was found by security researcher FourOne.
2128

29+
Fix CVE-2016-0775
30+
^^^^^^^^^^^^^^^^^
2231

23-
CVE-2016-0775 -- Buffer overflow in FliDecode.c
24-
-----------------------------------------------
32+
Buffer overflow in FliDecode.c.
2533

26-
In all versions of Pillow, dating back at least to the last PIL 1.1.7
27-
release, FliDecode.c has a buffer overflow error (:cve:`2016-0775`).
34+
.. note:: More information about this vulnerability included in database record :cve:`2016-0775`
35+
36+
In all versions of Pillow, dating back at least to
37+
the last PIL 1.1.7 release, FliDecode.c has a buffer overflow error.
2838

2939
Around line 192:
3040

@@ -49,11 +59,15 @@ off the end of the memory buffer, causing a segfault.
4959

5060
This issue was found by Alyssa Besseling at Atlassian.
5161

52-
CVE-2016-2533 -- Buffer overflow in PcdDecode.c
53-
-----------------------------------------------
62+
Fix CVE-2016-2533
63+
^^^^^^^^^^^^^^^^^
64+
65+
Buffer overflow in PcdDecode.c.
66+
67+
.. note:: More information about this vulnerability available in :cve:`2016-2533`
5468

55-
In all versions of Pillow, dating back at least to the last PIL 1.1.7
56-
release, ``PcdDecode.c`` has a buffer overflow error (:cve:`2016-2533`).
69+
In all versions of Pillow, dating back at least to the
70+
last PIL 1.1.7 release, ``PcdDecode.c`` has a buffer overflow error.
5771

5872
The ``state.buffer`` for ``PcdDecode.c`` is allocated based on a 3
5973
bytes per pixel sizing, where ``PcdDecode.c`` wrote into the buffer
@@ -62,7 +76,7 @@ the buffer into other Python object storage. In some cases, this
6276
causes a segfault, in others an internal Python malloc error.
6377

6478
Integer overflow in Resample.c
65-
------------------------------
79+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6680

6781
If a large value was passed into the new size for an image, it is
6882
possible to overflow an ``int32`` value passed into malloc.

docs/releasenotes/3.1.2.rst

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
21
3.1.2
3-
=====
2+
-----
3+
4+
Security
5+
========
6+
7+
Fix CVE-2016-3076
8+
^^^^^^^^^^^^^^^^^
9+
10+
Buffer overflow in Jpeg2KEncode.c.
411

5-
CVE-2016-3076 -- Buffer overflow in Jpeg2KEncode.c
6-
--------------------------------------------------
12+
.. note:: More information about this vulnerability included in database record :cve:`2016-3076`
713

8-
Pillow between 2.5.0 and 3.1.1 may overflow a buffer when writing
9-
large Jpeg2000 files, allowing for code execution or other memory
10-
corruption (:cve:`2016-3076`).
14+
Pillow between 2.5.0 and 3.1.1 may overflow a buffer
15+
when writing large Jpeg2000 files, allowing for code execution or other
16+
memory corruption.
1117

1218
This occurs specifically in the function ``j2k_encode_entry``, at the line:
1319

docs/releasenotes/6.2.0.rst

+32-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,38 @@
11
6.2.0
22
-----
33

4+
Security
5+
========
6+
7+
This release catches several buffer overruns and fixes CVE-2019-16865.
8+
9+
Buffer overruns
10+
^^^^^^^^^^^^^^^
11+
12+
In RawDecode.c, an error is now thrown if skip is calculated to be less than
13+
zero. It is intended to skip padding between lines, not to go backwards.
14+
15+
In PsdImagePlugin, if the combined sizes of the individual parts is larger than
16+
the declared size of the extra data field, then it looked for the next layer by
17+
seeking backwards. This is now corrected by seeking to (the start of the layer
18+
+ the size of the extra data field) instead of (the read parts of the layer +
19+
the rest of the layer).
20+
21+
Decompression bomb checks have been added to GIF and ICO formats.
22+
23+
An error is now raised if a TIFF dimension is a string, rather than trying to
24+
perform operations on it.
25+
26+
Fix CVE-2019-16865
27+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28+
29+
DOS attack vulnerabilities.
30+
31+
.. note:: More information about this vulnerability included in database record :cve:`2019-16865`
32+
33+
The CVE is regarding DOS problems, such as consuming large
34+
amounts of memory, or taking a large amount of time to process an image.
35+
436
API Additions
537
=============
638

@@ -65,27 +97,6 @@ There has been a longstanding warning that the defaults of ``Image.frombuffer``
6597
may change in the future for the "raw" decoder. The change will now take place
6698
in Pillow 7.0.
6799

68-
Security
69-
========
70-
71-
This release catches several buffer overruns, as well as addressing
72-
:cve:`2019-16865`. The CVE is regarding DOS problems, such as consuming large
73-
amounts of memory, or taking a large amount of time to process an image.
74-
75-
In RawDecode.c, an error is now thrown if skip is calculated to be less than
76-
zero. It is intended to skip padding between lines, not to go backwards.
77-
78-
In PsdImagePlugin, if the combined sizes of the individual parts is larger than
79-
the declared size of the extra data field, then it looked for the next layer by
80-
seeking backwards. This is now corrected by seeking to (the start of the layer
81-
+ the size of the extra data field) instead of (the read parts of the layer +
82-
the rest of the layer).
83-
84-
Decompression bomb checks have been added to GIF and ICO formats.
85-
86-
An error is now raised if a TIFF dimension is a string, rather than trying to
87-
perform operations on it.
88-
89100
Other Changes
90101
=============
91102

0 commit comments

Comments
 (0)