mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-24 07:40:32 +03:00
Merge pull request #6269 from radarhere/jpeg2k
This commit is contained in:
commit
3aef70ce39
BIN
Tests/images/zero_height.j2k
Normal file
BIN
Tests/images/zero_height.j2k
Normal file
Binary file not shown.
|
@ -2,7 +2,15 @@ from io import BytesIO
|
|||
|
||||
import pytest
|
||||
|
||||
from PIL import BmpImagePlugin, EpsImagePlugin, Image, ImageFile, _binary, features
|
||||
from PIL import (
|
||||
BmpImagePlugin,
|
||||
EpsImagePlugin,
|
||||
Image,
|
||||
ImageFile,
|
||||
UnidentifiedImageError,
|
||||
_binary,
|
||||
features,
|
||||
)
|
||||
|
||||
from .helper import (
|
||||
assert_image,
|
||||
|
@ -377,3 +385,7 @@ class TestPyEncoder(CodecsTest):
|
|||
|
||||
with pytest.raises(NotImplementedError):
|
||||
encoder.encode_to_file(None, None)
|
||||
|
||||
def test_zero_height(self):
|
||||
with pytest.raises(UnidentifiedImageError):
|
||||
Image.open("Tests/images/zero_height.j2k")
|
||||
|
|
|
@ -123,7 +123,7 @@ class ImageFile(Image.Image):
|
|||
) as v:
|
||||
raise SyntaxError(v) from v
|
||||
|
||||
if not self.mode or self.size[0] <= 0:
|
||||
if not self.mode or self.size[0] <= 0 or self.size[1] <= 0:
|
||||
raise SyntaxError("not identified by this driver")
|
||||
except BaseException:
|
||||
# close the file only if we have opened it this constructor
|
||||
|
|
Loading…
Reference in New Issue
Block a user