Merge branch 'master' into yapf-formatting

Conflicts:
	PIL/Image.py
This commit is contained in:
Alex Clark 2015-04-02 14:47:10 -04:00
commit 6d0a4a0149
5 changed files with 15 additions and 8 deletions

View File

@ -1,6 +1,12 @@
Changelog (Pillow) 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) 2.8.0 (2015-04-01)
------------------ ------------------

View File

@ -104,6 +104,7 @@ from PIL._util import deferred_error
import os import os
import sys import sys
import io import io
import struct
# type stuff # type stuff
import collections import collections
@ -882,8 +883,8 @@ class Image:
elif isinstance(t, int): elif isinstance(t, int):
self.im.putpalettealpha(t, 0) self.im.putpalettealpha(t, 0)
else: else:
raise ValueError( raise ValueError("Transparency for P mode should" +
"Transparency for P mode should" + " be bytes or int") " be bytes or int")
if mode == "P" and palette == ADAPTIVE: if mode == "P" and palette == ADAPTIVE:
im = self.im.quantize(colors) im = self.im.quantize(colors)
@ -2243,7 +2244,7 @@ def open(fp, mode="r"):
im = factory(fp, filename) im = factory(fp, filename)
_decompression_bomb_check(im.size) _decompression_bomb_check(im.size)
return im return im
except (SyntaxError, IndexError, TypeError): except (SyntaxError, IndexError, TypeError, struct.error):
# import traceback # import traceback
# traceback.print_exc() # traceback.print_exc()
pass pass
@ -2258,7 +2259,7 @@ def open(fp, mode="r"):
im = factory(fp, filename) im = factory(fp, filename)
_decompression_bomb_check(im.size) _decompression_bomb_check(im.size)
return im return im
except (SyntaxError, IndexError, TypeError): except (SyntaxError, IndexError, TypeError, struct.error):
# import traceback # import traceback
# traceback.print_exc() # traceback.print_exc()
pass pass

View File

@ -12,7 +12,7 @@
# ;-) # ;-)
VERSION = '1.1.7' # PIL version VERSION = '1.1.7' # PIL version
PILLOW_VERSION = '2.8.0' # Pillow PILLOW_VERSION = '2.8.1' # Pillow
_plugins = ['BmpImagePlugin', 'BufrStubImagePlugin', 'CurImagePlugin', _plugins = ['BmpImagePlugin', 'BufrStubImagePlugin', 'CurImagePlugin',
'DcxImagePlugin', 'EpsImagePlugin', 'FitsStubImagePlugin', 'DcxImagePlugin', 'EpsImagePlugin', 'FitsStubImagePlugin',

View File

@ -71,7 +71,7 @@
* See the README file for information on usage and redistribution. * 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" #include "Python.h"

View File

@ -90,7 +90,7 @@ except (ImportError, OSError):
NAME = 'Pillow' NAME = 'Pillow'
PILLOW_VERSION = '2.8.0' PILLOW_VERSION = '2.8.1'
TCL_ROOT = None TCL_ROOT = None
JPEG_ROOT = None JPEG_ROOT = None
JPEG2K_ROOT = None JPEG2K_ROOT = None