Skip to content

Conversation

@jholveck
Copy link
Contributor

Specifically, a negative width or height.

Particularly, this seems like an easy case for a user to hit if somebody forgets that the PIL tuple style uses top, left, RIGHT, BOTTOM and not top, left, WIDTH, HEIGHT.

Ask how I know.

Test that we do handle that gracefully.

Changes proposed in this PR

  • Quick test for a case I hit today.

It is very important to keep up to date tests and documentation.

  • Tests added/updated
  • Documentation updated - N/A

Is your code right?

  • ./check.sh passed

Specifically, a negative width or height.

Particularly, this seems like an easy case for a user to hit if
somebody forgets that the PIL tuple style uses top, left, RIGHT,
BOTTOM and not top, left, WIDTH, HEIGHT.

Ask how I know.

Test that we do handle that gracefully.
@BoboTiG
Copy link
Owner

BoboTiG commented Dec 21, 2025

I see macOS and Windows are less strict.

Should we add checks in our code instead of relying on the backend to fail?
It would also properly fix issues like in #270: invalid region or region with size < 1 should be reported early.

@jholveck
Copy link
Contributor Author

Yeah, I was surprised about that here too!

I'll add a test in grab to check the bounds, and make sure it gets invoked in the other paths too.

I thought I'd seen a test for for invalid regions somewhere before...
@BoboTiG BoboTiG mentioned this pull request Dec 21, 2025
@BoboTiG BoboTiG merged commit 9d279d8 into BoboTiG:main Dec 21, 2025
21 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