Skip to content

Conversation

@cgohlke
Copy link
Contributor

@cgohlke cgohlke commented Oct 26, 2022

Fixes possible buffer overflow.

@cgohlke
Copy link
Contributor Author

cgohlke commented Oct 27, 2022

As expected, it's easy to crash the current implementation with any input exceeding 4*sizeof(long), e.g.:

Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import ImageFont
>>> f = ImageFont.truetype('cmr10.ttf')
>>> f
<PIL.ImageFont.FreeTypeFont object at 0x0000028609BF0510>
>>> f.set_variation_by_axes([0] * 5)
Windows fatal exception: access violation

Current thread 0x0000126c (most recent call first):
  File "X:\Python311\Lib\site-packages\PIL\ImageFont.py", line 828 in set_variation_by_axes
  File "<stdin>", line 1 in <module>

@hugovk hugovk added this to the 9.3.0 milestone Oct 27, 2022
@hugovk hugovk merged commit 3cd8eae into python-pillow:main Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants