-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
A ZeroDivisionError occurs at line 105 in WmfImagePlugin.py when the below code is run. A check to self._inch is missed, resulting in a ZeroDivisionError rather than an "Unsupported file format" message.
import PIL.Image as Im
import io
data = io.BytesIO(b'\xd7\xcd\xc6\x9a\x00\x00\xff\xff\xff\xff\x00\x00\x00<\x00\x00')
Im.open(data)Version:
pip show pillow
Name: pillow
Version: 11.1.0.dev0
Trace:
Traceback (most recent call last):
File "rep.py", line 5, in <module>
Im.open(data)
File "python3.9/site-packages/PIL/Image.py", line 3511, in open
im = _open_core(
File "python3.9/site-packages/PIL/Image.py", line 3494, in _open_core
im = factory(fp, filename)
File "python3.9/site-packages/PIL/ImageFile.py", line 144, in __init__
self._open()
File "python3.9/site-packages/PIL/WmfImagePlugin.py", line 105, in _open
(x1 - x0) * self.info["dpi"] // self._inch,
ZeroDivisionError: integer division or modulo by zeroMetadata
Metadata
Assignees
Labels
No labels