4595N/APatch based on upstream commit to Pillow 2.7.0 (PIL fork)
4595N/ANote that this patch includes a test of the fix, which requires an
4595N/Asince it cannot be patched in.
4595N/A@@ -68,6 +68,12 @@ _MODES = {
4595N/A (16,6): ("RGBA", "RGBA;16B"),
4595N/A+def _safe_zlib_decompress(s):
4595N/A+ raise ValueError("Decompressed Data Too Large")
4595N/A # --------------------------------------------------------------------
4595N/A # Support classes. Suitable for PNG and related formats like MNG etc.
4595N/A@@ -197,7 +203,7 @@ class PngStream(ChunkStream):
4595N/A raise SyntaxError("Unknown compression method %s in iCCP chunk" % comp_method)
4595N/A+ icc_profile = _safe_zlib_decompress(s[i+2:])
4595N/A@@ -293,7 +299,7 @@ class PngStream(ChunkStream):
4595N/A raise SyntaxError("Unknown compression method %s in zTXt chunk" % comp_method)
4595N/A # --------------------------------------------------------------------
4595N/A@@ -9,6 +9,7 @@ from PIL import Image
4595N/A from PIL import ImageFilter
4595N/A+from PIL import PngImagePlugin
4595N/A@@ -146,6 +147,15 @@ def testimage():
4595N/A+ Test fix to PNG decompression DOS #1060
4595N/A+ ... except ValueError as msg:
4595N/A+ Decompressed Data Too Large
4595N/A PIL can do many other things, but I'll leave that for another
4595N/A day. If you're curious, check the handbook, available from: