Skip to content

Avoid divide-by-zero crash in image filtering#9755

Open
lukegb wants to merge 3 commits into
python-pillow:mainfrom
lukegb:pls-no-fpe
Open

Avoid divide-by-zero crash in image filtering#9755
lukegb wants to merge 3 commits into
python-pillow:mainfrom
lukegb:pls-no-fpe

Conversation

@lukegb

@lukegb lukegb commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Changes proposed in this pull request:

  • Avoid divide-by-zero crash in image filtering - although a kernel size of 1 is pointless/trivial, but it shouldn't cause the C extension to crash.

Fixes a crash accidentally introduced by the validation logic added in dff01a0.

lukegb and others added 2 commits July 2, 2026 13:07
A kernel size of 1 is pointless/trivial, but it shouldn't cause the C
extension to crash.
@codspeed-hq

codspeed-hq Bot commented Jul 2, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 345 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing lukegb:pls-no-fpe (9f7010d) with main (1cf685c)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@radarhere

radarhere commented Jul 3, 2026

Copy link
Copy Markdown
Member

I've created lukegb#3 with a suggestion - rather than expand the image by zero, I think just copying the image would be more efficient.

You probably want to keep margin > 0 for defensiveness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants