fix for crash-8115

This commit is contained in:
Eric Soroos 2021-03-31 21:16:43 +02:00
parent 45530d5ce1
commit 53c80281d7
3 changed files with 5 additions and 0 deletions

View File

@ -34,6 +34,7 @@ from .helper import on_ci
"Tests/images/crash-f46f5b2f43c370fe65706c11449f567ecc345e74.tif",
"Tests/images/crash-63b1dffefc8c075ddc606c0a2f5fdc15ece78863.tif",
"Tests/images/crash-74d2a78403a5a59db1fb0a2b8735ac068a75f6e3.tif",
"Tests/images/crash-81154a65438ba5aaeca73fd502fa4850fbde60f8.tif",
],
)

View File

@ -1250,6 +1250,10 @@ class TiffImageFile(ImageFile.ImageFile):
if bps_count > len(bps_tuple) and len(bps_tuple) == 1:
bps_tuple = bps_tuple * bps_count
samplesPerPixel = self.tag_v2.get(SAMPLESPERPIXEL, 1)
if len(bps_tuple) != samplesPerPixel:
raise SyntaxError("unknown data organization")
# mode: check photometric interpretation and bits per pixel
key = (
self.tag_v2.prefix,