mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Return early if either width or height is zero
This commit is contained in:
parent
eaeda4a6be
commit
1270043682
|
@ -71,6 +71,11 @@ def test_color_modes() -> None:
|
|||
box_blur(sample.convert("YCbCr"))
|
||||
|
||||
|
||||
@pytest.mark.parametrize("size", ((0, 1), (1, 0)))
|
||||
def test_zero_dimension(size: tuple[int, int]) -> None:
|
||||
assert box_blur(Image.new("L", size)).size == size
|
||||
|
||||
|
||||
def test_radius_0() -> None:
|
||||
assert_blur(
|
||||
sample,
|
||||
|
|
|
@ -238,6 +238,9 @@ ImagingBoxBlur(Imaging imOut, Imaging imIn, float xradius, float yradius, int n)
|
|||
int i;
|
||||
Imaging imTransposed;
|
||||
|
||||
if (imOut->xsize == 0 || imOut->ysize == 0) {
|
||||
return imOut;
|
||||
}
|
||||
if (n < 1) {
|
||||
return ImagingError_ValueError("number of passes must be greater than zero");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user