diff -Naur Imaging-1.1.7/libImaging/Imaging.h Imaging-1.1.7.new/libImaging/Imaging.h --- Imaging-1.1.7/libImaging/Imaging.h 2009-11-01 01:44:12.000000000 +0100 +++ Imaging-1.1.7.new/libImaging/Imaging.h 2014-08-26 08:21:21.800293098 +0200 @@ -75,7 +75,7 @@ struct ImagingMemoryInstance { /* Format */ - char mode[4+1]; /* Band names ("1", "L", "P", "RGB", "RGBA", "CMYK") */ + char mode[6+1]; /* Band names ("1", "L", "P", "RGB", "RGBA", "CMYK", "YCbCr", "BGR;xy") */ int type; /* Data type (IMAGING_TYPE_*) */ int depth; /* Depth (ignored in this version) */ int bands; /* Number of bands (1, 2, 3, or 4) */ diff -Naur Imaging-1.1.7/PIL/IcnsImagePlugin.py Imaging-1.1.7.new/PIL/IcnsImagePlugin.py --- Imaging-1.1.7/PIL/IcnsImagePlugin.py 2009-11-01 01:44:11.000000000 +0100 +++ Imaging-1.1.7.new/PIL/IcnsImagePlugin.py 2014-08-26 08:21:21.801293127 +0200 @@ -115,6 +115,8 @@ i = HEADERSIZE while i < filesize: sig, blocksize = nextheader(fobj) + if blocksize <= 0: + raise SyntaxError('invalid block header') i = i + HEADERSIZE blocksize = blocksize - HEADERSIZE dct[sig] = (i, blocksize) diff -Naur Imaging-1.1.7/PIL/Image.py Imaging-1.1.7.new/PIL/Image.py --- Imaging-1.1.7/PIL/Image.py 2009-11-15 16:51:25.000000000 +0100 +++ Imaging-1.1.7.new/PIL/Image.py 2014-08-26 08:21:21.800293098 +0200 @@ -1494,11 +1494,11 @@ def split(self): "Split image into bands" + self.load() if self.im.bands == 1: ims = [self.copy()] else: ims = [] - self.load() for i in range(self.im.bands): ims.append(self._new(self.im.getband(i))) return tuple(ims) diff -Naur Imaging-1.1.7/Scripts/pilfont.py Imaging-1.1.7.new/Scripts/pilfont.py --- Imaging-1.1.7/Scripts/pilfont.py 2009-11-01 01:44:12.000000000 +0100 +++ Imaging-1.1.7.new/Scripts/pilfont.py 2014-08-26 08:21:21.800293098 +0200 @@ -1,3 +1,5 @@ +#! /usr/bin/python + # # The Python Imaging Library # $Id$ diff -Naur Imaging-1.1.7/setup.py Imaging-1.1.7.new/setup.py --- Imaging-1.1.7/setup.py 2009-11-15 17:06:10.000000000 +0100 +++ Imaging-1.1.7.new/setup.py 2014-08-26 08:21:21.800293098 +0200 @@ -6,6 +6,8 @@ # import glob, os, re, struct, string, sys +import subprocess +from distutils.spawn import find_executable # make it possible to run the setup script from another directory try: @@ -147,6 +149,16 @@ add_directory(library_dirs, "/opt/local/lib") add_directory(include_dirs, "/opt/local/include") + elif find_executable('dpkg-architecture'): + # Debian/Ubuntu multiarch support. + proc = subprocess.Popen( + 'dpkg-architecture -qDEB_HOST_MULTIARCH'.split(), + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + stdout, stderr = proc.communicate() + multiarch_path = stdout.strip() + add_directory(include_dirs, '/usr/include/' + multiarch_path) + add_directory(library_dirs, '/usr/lib/' + multiarch_path) + add_directory(library_dirs, "/usr/local/lib") # FIXME: check /opt/stuff directories here? diff -Naur Imaging-1.1.7/Tests/check_icns_dos.py Imaging-1.1.7.new/Tests/check_icns_dos.py --- Imaging-1.1.7/Tests/check_icns_dos.py 1970-01-01 01:00:00.000000000 +0100 +++ Imaging-1.1.7.new/Tests/check_icns_dos.py 2014-08-26 08:21:21.800293098 +0200 @@ -0,0 +1,10 @@ +# Tests potential DOS of IcnsImagePlugin 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('icns\x00\x00\x00\x10hang\x00\x00\x00\x00'))) +else: + Image.open(BytesIO(bytes('icns\x00\x00\x00\x10hang\x00\x00\x00\x00', 'latin-1')))