Skip to content

Commit

Permalink
fix for crash-8115
Browse files Browse the repository at this point in the history
  • Loading branch information
wiredfool committed Mar 31, 2021
1 parent c290c1f commit 2491ebf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Binary file not shown.
1 change: 1 addition & 0 deletions Tests/test_tiff_crashes.py
Expand Up @@ -34,6 +34,7 @@
"Tests/images/crash-f46f5b2f43c370fe65706c11449f567ecc345e74.tif",
"Tests/images/crash-63b1dffefc8c075ddc606c0a2f5fdc15ece78863.tif",
"Tests/images/crash-74d2a78403a5a59db1fb0a2b8735ac068a75f6e3.tif",
"Tests/images/crash-81154a65438ba5aaeca73fd502fa4850fbde60f8.tif",
],
)
Expand Down
4 changes: 4 additions & 0 deletions src/PIL/TiffImagePlugin.py
Expand Up @@ -1250,6 +1250,10 @@ def _setup(self):
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,
Expand Down

0 comments on commit 2491ebf

Please sign in to comment.