diff --git a/CHANGES.rst b/CHANGES.rst index 88720be67..88c9a7793 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ Changelog (Pillow) ================== +2.8.1 (2015-04-02) +------------------ + +- Bug fix: Catch struct.error on invalid JPEG, fixes #1163 + [wiredfool, hugovk] + 2.8.0 (2015-04-01) ------------------ diff --git a/PIL/Image.py b/PIL/Image.py index 46027ba33..9fbee2bea 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -104,6 +104,7 @@ from PIL._util import deferred_error import os import sys import io +import struct # type stuff import collections @@ -589,7 +590,7 @@ class Image: def _repr_png_(self): """ iPython display hook support - + :returns: png version of the image as bytes """ from io import BytesIO @@ -882,8 +883,8 @@ class Image: elif isinstance(t, int): self.im.putpalettealpha(t, 0) else: - raise ValueError( - "Transparency for P mode should" + " be bytes or int") + raise ValueError("Transparency for P mode should" + + " be bytes or int") if mode == "P" and palette == ADAPTIVE: im = self.im.quantize(colors) @@ -2243,7 +2244,7 @@ def open(fp, mode="r"): im = factory(fp, filename) _decompression_bomb_check(im.size) return im - except (SyntaxError, IndexError, TypeError): + except (SyntaxError, IndexError, TypeError, struct.error): # import traceback # traceback.print_exc() pass @@ -2258,7 +2259,7 @@ def open(fp, mode="r"): im = factory(fp, filename) _decompression_bomb_check(im.size) return im - except (SyntaxError, IndexError, TypeError): + except (SyntaxError, IndexError, TypeError, struct.error): # import traceback # traceback.print_exc() pass diff --git a/PIL/__init__.py b/PIL/__init__.py index 6c787984f..543268bc1 100644 --- a/PIL/__init__.py +++ b/PIL/__init__.py @@ -12,7 +12,7 @@ # ;-) VERSION = '1.1.7' # PIL version -PILLOW_VERSION = '2.8.0' # Pillow +PILLOW_VERSION = '2.8.1' # Pillow _plugins = ['BmpImagePlugin', 'BufrStubImagePlugin', 'CurImagePlugin', 'DcxImagePlugin', 'EpsImagePlugin', 'FitsStubImagePlugin', diff --git a/_imaging.c b/_imaging.c index c3be9beab..08e003c80 100644 --- a/_imaging.c +++ b/_imaging.c @@ -71,7 +71,7 @@ * See the README file for information on usage and redistribution. */ -#define PILLOW_VERSION "2.8.0" +#define PILLOW_VERSION "2.8.1" #include "Python.h" diff --git a/setup.py b/setup.py index a5f114d88..3887b421d 100644 --- a/setup.py +++ b/setup.py @@ -90,7 +90,7 @@ except (ImportError, OSError): NAME = 'Pillow' -PILLOW_VERSION = '2.8.0' +PILLOW_VERSION = '2.8.1' TCL_ROOT = None JPEG_ROOT = None JPEG2K_ROOT = None