Do not render text if image has zero width or height#7021
Do not render text if image has zero width or height#7021radarhere merged 1 commit intopython-pillow:mainfrom
Conversation
|
Seems fine, but I wonder how often someone will draw on an image with non-zero width/height, and how much time this would actually save them? |
|
Lines 761 to 769 in 80edcd1 |
|
Sure, but this would only happen if a user tries to render a string containing spaces only, right? In which case I'd argue that might be up to the user to prevent, as that doesn't seem like something that would be commonly done. |
|
Aside from performance motivations, I was primarily thinking about https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=48708 Locally, #6842 resolved the problem with memory usage, but apparently oss-fuzz itself doesn't think it is fixed yet, so this is a second attempt. The font in the issue can trigger an |
In
FreeTypeFont.getmask2(), only spend time rendering text if the image it will be rendered onto has a non-zero width or height.