mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Return from ImagingFill early if image has a zero dimension
This commit is contained in:
parent
77f6f54ac4
commit
91b01f4cc2
|
@ -512,6 +512,11 @@ class TestImage:
|
|||
i = Image.new("RGB", [1, 1])
|
||||
assert isinstance(i.size, tuple)
|
||||
|
||||
@pytest.mark.parametrize("size", ((0, 100000000), (100000000, 0)))
|
||||
@pytest.mark.timeout(0.5)
|
||||
def test_empty_image(self, size):
|
||||
Image.new("RGB", size)
|
||||
|
||||
def test_storage_neg(self):
|
||||
# Storage.c accepted negative values for xsize, ysize. Was
|
||||
# test_neg_ppm, but the core function for that has been
|
||||
|
|
|
@ -24,6 +24,11 @@ ImagingFill(Imaging im, const void *colour) {
|
|||
int x, y;
|
||||
ImagingSectionCookie cookie;
|
||||
|
||||
/* 0-width or 0-height image. No need to do anything */
|
||||
if (!im->linesize || !im->ysize) {
|
||||
return im;
|
||||
}
|
||||
|
||||
if (im->type == IMAGING_TYPE_SPECIAL) {
|
||||
/* use generic API */
|
||||
ImagingAccess access = ImagingAccessNew(im);
|
||||
|
|
Loading…
Reference in New Issue
Block a user