9.4.0 (2023-01-02)
Security
Fix memory DOS in ImageFont
A corrupt or specially crafted TTF font could have font metrics that lead to
unreasonably large sizes when rendering text in font. ImageFont.py did not
check the image size before allocating memory for it. This dates to the PIL
fork. Pillow 8.2.0 added a check for large sizes, but did not consider the
case where one dimension is zero.
Null pointer dereference crash in ImageFont
Pillow attempted to dereference a null pointer in ImageFont, leading to a
crash. An error is now raised instead. This has been present since
Pillow 8.0.0.
API additions
Added start position for getmask and getmask2
Text may render differently when starting at fractional coordinates, so
FreeTypeFont.getmask() and now
support a argument. This tuple of horizontal and vertical offset
will be used internally by to more accurately place
text at the coordinates.