diff --git a/CHANGES.rst b/CHANGES.rst index 141d5c715..32427b277 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -61,6 +61,11 @@ Changelog (Pillow) - Test PalmImagePlugin and method to skip known bad tests #776 [hugovk, wiredfool] +2.5.3 (2014-08-18) +------------------ + +- Fixed CVE-2014-3598, a DOS in the Jpeg2KImagePlugin + [Andrew Drake] 2.5.2 (2014-08-13) ------------------ @@ -68,7 +73,6 @@ Changelog (Pillow) - Fixed CVE-2014-3589, a DOS in the IcnsImagePlugin (backport) [Andrew Drake] - 2.5.1 (2014-07-10) ------------------ diff --git a/PIL/Jpeg2KImagePlugin.py b/PIL/Jpeg2KImagePlugin.py index 0a7a6e297..53b10ca1a 100644 --- a/PIL/Jpeg2KImagePlugin.py +++ b/PIL/Jpeg2KImagePlugin.py @@ -70,6 +70,9 @@ def _parse_jp2_header(fp): else: hlen = 8 + if lbox < hlen: + raise SyntaxError('Invalid JP2 header length') + if tbox == b'jp2h': header = fp.read(lbox - hlen) break diff --git a/PIL/__init__.py b/PIL/__init__.py index 56edaf247..7b4b8abfa 100644 --- a/PIL/__init__.py +++ b/PIL/__init__.py @@ -12,7 +12,7 @@ # ;-) VERSION = '1.1.7' # PIL version -PILLOW_VERSION = '2.5.0' # Pillow +PILLOW_VERSION = '2.5.3' # Pillow _plugins = ['BmpImagePlugin', 'BufrStubImagePlugin', diff --git a/Tests/check_j2k_dos.py b/Tests/check_j2k_dos.py new file mode 100644 index 000000000..68f065bbc --- /dev/null +++ b/Tests/check_j2k_dos.py @@ -0,0 +1,11 @@ +# Tests potential DOS of Jpeg2kImagePlugin with 0 length block. +# Run from anywhere that PIL is importable. + +from PIL import Image +from io import BytesIO + +if bytes is str: + Image.open(BytesIO(bytes('\x00\x00\x00\x0cjP\x20\x20\x0d\x0a\x87\x0a\x00\x00\x00\x00hang'))) +else: + Image.open(BytesIO(bytes('\x00\x00\x00\x0cjP\x20\x20\x0d\x0a\x87\x0a\x00\x00\x00\x00hang', 'latin-1'))) + diff --git a/Tests/test_file_icns.py b/Tests/test_file_icns.py index 99f6da9e3..9f676dd71 100644 --- a/Tests/test_file_icns.py +++ b/Tests/test_file_icns.py @@ -57,6 +57,10 @@ class TestFileIcns(PillowTestCase): if not enable_jpeg2k: return + self.skipKnownBadTest("Jpeg2000 hangs on Travis on OSX", + platform='darwin', + travis=True) + im = Image.open('Tests/images/pillow3.icns') for w, h, r in im.info['sizes']: wr = w * r diff --git a/Tests/test_file_jpeg2k.py b/Tests/test_file_jpeg2k.py index a0e7dfb53..4f0f84d16 100644 --- a/Tests/test_file_jpeg2k.py +++ b/Tests/test_file_jpeg2k.py @@ -18,6 +18,9 @@ class TestFileJpeg2k(PillowTestCase): def setUp(self): if "jpeg2k_encoder" not in codecs or "jpeg2k_decoder" not in codecs: self.skipTest('JPEG 2000 support not available') + self.skipKnownBadTest("Jpeg2000 hangs on Travis on OSX", + platform='darwin', + travis=True) def roundtrip(self, im, **options): out = BytesIO() diff --git a/_imaging.c b/_imaging.c index c28bd4d93..ec8205dd4 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.5.0" +#define PILLOW_VERSION "2.5.3" #include "Python.h" diff --git a/setup.py b/setup.py index 980519151..58060f965 100644 --- a/setup.py +++ b/setup.py @@ -90,7 +90,7 @@ except (ImportError, OSError): NAME = 'Pillow' -PILLOW_VERSION = '2.5.0' +PILLOW_VERSION = '2.5.3' TCL_ROOT = None JPEG_ROOT = None JPEG2K_ROOT = None