Skip to content

fix: guard against division by zero in create_gaussian_filter() - #3171

Merged
davisking merged 2 commits into
davisking:masterfrom
lippinj:upstream-fix-3
Oct 17, 2026
Merged

davisking merged 2 commits into
davisking:masterfrom
lippinj:upstream-fix-3

Conversation

@lippinj

@lippinj lippinj commented Oct 16, 2026

Copy link
Copy Markdown

When sigma is very small, gaussian(max_size/2, sigma) can underflow to zero, causing a division by zero in the loop condition. Add epsilon to the denominator.

Joonas Lipping and others added 2 commits October 16, 2026 08:25
…ian_filter()

When sigma is very small, gaussian(max_size/2, sigma) can underflow to
zero, causing a division by zero in the loop condition. Add epsilon to
the denominator.

Copy link
Copy Markdown
Owner

Thanks @lippinj for finding this. I changed the cutoff condition to a division-free comparison so it handles zero tails without shifting the cutoff with epsilon, and added kernel, boundary, blur, and floating-point exception regression tests.

@davisking
davisking merged commit 8070802 into davisking:master Oct 17, 2026
13 checks passed
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