Skip to content

Crash when using Draw.text with invalid type #8307

@jonashaag

Description

@jonashaag

What did you do?

from PIL import Image, ImageDraw
img = Image.new("L", (1, 1))
ImageDraw.Draw(img).text((0, 0), ("a", "b"))

What did you expect to happen?

Should raise a TypeError

What actually happened?

It crashed.

What are your OS, Python and Pillow versions?

  • OS: latest macOS
  • Python: 3.12.5
  • Pillow: pillow 10.4.0 py312h39b1d8d_0 40.4 MiB conda pillow-10.4.0-py312h39b1d8d_0.conda
--------------------------------------------------------------------
Pillow 10.4.0
Python 3.12.5 | packaged by conda-forge | (main, Aug  8 2024, 18:32:50) [Clang 16.0.6 ]
--------------------------------------------------------------------
Python executable is .../.pixi/envs/default/bin/python3
System Python files loaded from .../.pixi/envs/default
--------------------------------------------------------------------
Python Pillow modules loaded from .../.pixi/envs/default/lib/python3.12/site-packages/PIL
Binary Pillow modules loaded from .../.pixi/envs/default/lib/python3.12/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 10.4.0
--- TKINTER support ok, loaded 8.6
--- FREETYPE2 support ok, loaded 2.12.1
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.4.0
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 3.0.0
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.3.1
--- LIBTIFF support ok, loaded 4.6.0
*** RAQM (Bidirectional Text) support not installed
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
--------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions