Skip to content

Fix underflows and panics around Gaussian blur for empty images#3007

Open
RunDevelopment wants to merge 1 commit into
image-rs:mainfrom
RunDevelopment:sample-underflow
Open

Fix underflows and panics around Gaussian blur for empty images#3007
RunDevelopment wants to merge 1 commit into
image-rs:mainfrom
RunDevelopment:sample-underflow

Conversation

@RunDevelopment
Copy link
Copy Markdown
Member

Addresses M12 from #2954.

The issue was some operations inside the various functions implementing Gaussian blur assumed that there is at least one pixel. This is obviously not the case, so underflow and panics were possible.

I fixed this by changing the type representing the size of an image to filter. The type now represents non-empty image sizes. This solves the issue by making the assumption true.

During testing, I also found a bug in GenericImageView::Pixels. This iterator didn't specify its stop condition correctly, which made OOB panics possible. I fixed that too.

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.

1 participant