smani pushed to python-pillow (f21). "Update to 2.6.2, add python-pillow_PySequence_Fast_GET_ITEM.patch"
notifications at fedoraproject.org
notifications at fedoraproject.org
Wed Apr 1 14:59:42 UTC 2015
>From 2c5847c70c7622e684b9fbb9f08a8830a23df5e4 Mon Sep 17 00:00:00 2001
From: Sandro Mani <manisandro at gmail.com>
Date: Wed, 1 Apr 2015 16:59:28 +0200
Subject: Update to 2.6.2, add python-pillow_PySequence_Fast_GET_ITEM.patch
diff --git a/.gitignore b/.gitignore
index 49d0203..e73e678 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@
/python-pillow-Pillow-2.5.3-0-g68c6904.tar.gz
/python-pillow-Pillow-2.6.0-0-g9634e43.tar.gz
/python-pillow-Pillow-2.6.1-0-g4a8471d.tar.gz
+/python-pillow-Pillow-2.6.2-0-g9f0ec3b.tar.gz
diff --git a/python-pillow.spec b/python-pillow.spec
index 7238d66..319a81b 100644
--- a/python-pillow.spec
+++ b/python-pillow.spec
@@ -17,7 +17,7 @@
# Refer to the comment for Source0 below on how to obtain the source tarball
# The saved file has format python-imaging-Pillow-$version-$ahead-g$shortcommit.tar.gz
-%global commit 4a8471dea18f6196161e4444ce5625f46cecd1e1
+%global commit 9f0ec3b0d7637e04fa735d7dfb94464301b02c1e
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global ahead 0
@@ -27,8 +27,8 @@
%endif
Name: python-pillow
-Version: 2.6.1
-Release: 2%{?snap}%{?dist}
+Version: 2.6.2
+Release: 1%{?snap}%{?dist}
Summary: Python image processing library
# License: see http://www.pythonware.com/products/pil/license.htm
@@ -39,8 +39,8 @@ URL: http://python-pillow.github.io/
# wget --content-disposition https://github.com/python-pillow/Pillow/tarball/$commit
Source0: https://github.com/python-pillow/Pillow/tarball/%{commit}/python-pillow-Pillow-%{version}-%{ahead}-g%{shortcommit}.tar.gz
-# Backport for upstream commit https://github.com/python-pillow/Pillow/commit/b3e09122e527ae554eb590741bbd7611d5710e40, see #1179354
-Patch0: python-pillow_PNG-decompression-DOS.patch
+# Backport for upstream commit https://github.com/python-pillow/Pillow/commit/f75c5562c7a6a887bdcb8c7f93022fa1fdfcee09
+Patch0: python-pillow_PySequence_Fast_GET_ITEM.patch
BuildRequires: tk-devel
BuildRequires: libjpeg-devel
@@ -215,6 +215,7 @@ PIL image wrapper for Qt.
%prep
%setup -q -n python-pillow-Pillow-%{shortcommit}
+%patch0 -p1
# Fix spurious-executable-perm
chmod -x libImaging/Jpeg2KEncode.c
@@ -394,6 +395,9 @@ popd
%endif
%changelog
+* Wed Apr 01 2015 Sandro Mani <manisandro at gmail.com> - 2.6.2-1
+- Update to 2.6.2
+
* Mon Jan 12 2015 Sandro Mani <manisandro at gmail.com> - 2.6.1-2
- Add python-pillow_PNG-decompression-DOS.patch (fixes #1179354)
- Fix headers installation directory
diff --git a/python-pillow_PNG-decompression-DOS.patch b/python-pillow_PNG-decompression-DOS.patch
deleted file mode 100644
index c36cd73..0000000
--- a/python-pillow_PNG-decompression-DOS.patch
+++ /dev/null
@@ -1,174 +0,0 @@
-diff -rupN python-pillow-Pillow-4a8471d/docs/handbook/image-file-formats.rst python-pillow-Pillow-4a8471d-new/docs/handbook/image-file-formats.rst
---- python-pillow-Pillow-4a8471d/docs/handbook/image-file-formats.rst 2014-10-13 19:13:17.000000000 +0200
-+++ python-pillow-Pillow-4a8471d-new/docs/handbook/image-file-formats.rst 2015-01-12 18:02:47.989193394 +0100
-@@ -332,6 +332,14 @@ The :py:meth:`~PIL.Image.Image.open` met
- Transparency color index. This key is omitted if the image is not a
- transparent palette image.
-
-+``Open`` also sets ``Image.text`` to a list of the values of the
-+``tEXt``, ``zTXt``, and ``iTXt`` chunks of the PNG image. Individual
-+compressed chunks are limited to a decompressed size of
-+``PngImagePlugin.MAX_TEXT_CHUNK``, by default 1MB, to prevent
-+decompression bombs. Additionally, the total size of all of the text
-+chunks is limited to ``PngImagePlugin.MAX_TEXT_MEMORY``, defaulting to
-+64MB.
-+
- The :py:meth:`~PIL.Image.Image.save` method supports the following options:
-
- **optimize**
-diff -rupN python-pillow-Pillow-4a8471d/PIL/PngImagePlugin.py python-pillow-Pillow-4a8471d-new/PIL/PngImagePlugin.py
---- python-pillow-Pillow-4a8471d/PIL/PngImagePlugin.py 2014-10-13 19:13:17.000000000 +0200
-+++ python-pillow-Pillow-4a8471d-new/PIL/PngImagePlugin.py 2015-01-12 18:00:52.626295631 +0100
-@@ -72,6 +72,19 @@ _MODES = {
-
- _simple_palette = re.compile(b'^\xff+\x00\xff*$')
-
-+# Maximum decompressed size for a iTXt or zTXt chunk.
-+# Eliminates decompression bombs where compressed chunks can expand 1000x
-+MAX_TEXT_CHUNK = ImageFile.SAFEBLOCK
-+# Set the maximum total text chunk size.
-+MAX_TEXT_MEMORY = 64 * MAX_TEXT_CHUNK
-+
-+def _safe_zlib_decompress(s):
-+ dobj = zlib.decompressobj()
-+ plaintext = dobj.decompress(s, MAX_TEXT_CHUNK)
-+ if dobj.unconsumed_tail:
-+ raise ValueError("Decompressed Data Too Large")
-+ return plaintext
-+
-
- # --------------------------------------------------------------------
- # Support classes. Suitable for PNG and related formats like MNG etc.
-@@ -229,6 +242,14 @@ class PngStream(ChunkStream):
- self.im_tile = None
- self.im_palette = None
-
-+ self.text_memory = 0
-+
-+ def check_text_memory(self, chunklen):
-+ self.text_memory += chunklen
-+ if self.text_memory > MAX_TEXT_MEMORY:
-+ raise ValueError("Too much memory used in text chunks: %s>MAX_TEXT_MEMORY" %
-+ self.text_memory)
-+
- def chunk_iCCP(self, pos, length):
-
- # ICC profile
-@@ -247,7 +268,7 @@ class PngStream(ChunkStream):
- raise SyntaxError("Unknown compression method %s in iCCP chunk" %
- comp_method)
- try:
-- icc_profile = zlib.decompress(s[i+2:])
-+ icc_profile = _safe_zlib_decompress(s[i+2:])
- except zlib.error:
- icc_profile = None # FIXME
- self.im_info["icc_profile"] = icc_profile
-@@ -341,6 +362,8 @@ class PngStream(ChunkStream):
- v = v.decode('latin-1', 'replace')
-
- self.im_info[k] = self.im_text[k] = v
-+ self.check_text_memory(len(v))
-+
- return s
-
- def chunk_zTXt(self, pos, length):
-@@ -361,7 +384,7 @@ class PngStream(ChunkStream):
- comp_method)
- import zlib
- try:
-- v = zlib.decompress(v[1:])
-+ v = _safe_zlib_decompress(v[1:])
- except zlib.error:
- v = b""
-
-@@ -371,6 +394,8 @@ class PngStream(ChunkStream):
- v = v.decode('latin-1', 'replace')
-
- self.im_info[k] = self.im_text[k] = v
-+ self.check_text_memory(len(v))
-+
- return s
-
- def chunk_iTXt(self, pos, length):
-@@ -392,7 +417,7 @@ class PngStream(ChunkStream):
- if cm == 0:
- import zlib
- try:
-- v = zlib.decompress(v)
-+ v = _safe_zlib_decompress(v)
- except zlib.error:
- return s
- else:
-@@ -407,7 +432,8 @@ class PngStream(ChunkStream):
- return s
-
- self.im_info[k] = self.im_text[k] = iTXt(v, lang, tk)
--
-+ self.check_text_memory(len(v))
-+
- return s
-
-
-diff -rupN python-pillow-Pillow-4a8471d/Tests/check_png_dos.py python-pillow-Pillow-4a8471d-new/Tests/check_png_dos.py
---- python-pillow-Pillow-4a8471d/Tests/check_png_dos.py 1970-01-01 01:00:00.000000000 +0100
-+++ python-pillow-Pillow-4a8471d-new/Tests/check_png_dos.py 2015-01-12 18:00:52.627295648 +0100
-@@ -0,0 +1,47 @@
-+from helper import unittest, PillowTestCase
-+from PIL import Image, PngImagePlugin
-+from io import BytesIO
-+import zlib
-+
-+TEST_FILE = "Tests/images/png_decompression_dos.png"
-+
-+class TestPngDos(PillowTestCase):
-+ def test_dos_text(self):
-+
-+ try:
-+ im = Image.open(TEST_FILE)
-+ im.load()
-+ except ValueError as msg:
-+ self.assertTrue(msg, "Decompressed Data Too Large")
-+ return
-+
-+ for s in im.text.values():
-+ self.assertLess(len(s), 1024*1024, "Text chunk larger than 1M")
-+
-+ def test_dos_total_memory(self):
-+ im = Image.new('L',(1,1))
-+ compressed_data = zlib.compress('a'*1024*1023)
-+
-+ info = PngImagePlugin.PngInfo()
-+
-+ for x in range(64):
-+ info.add_text('t%s'%x, compressed_data, 1)
-+ info.add_itxt('i%s'%x, compressed_data, zip=True)
-+
-+ b = BytesIO()
-+ im.save(b, 'PNG', pnginfo=info)
-+ b.seek(0)
-+
-+ try:
-+ im2 = Image.open(b)
-+ except ValueError as msg:
-+ self.assertIn("Too much memory", msg)
-+ return
-+
-+ total_len = 0
-+ for txt in im2.text.values():
-+ total_len += len(txt)
-+ self.assertLess(total_len, 64*1024*1024, "Total text chunks greater than 64M")
-+
-+if __name__ == '__main__':
-+ unittest.main()
-diff -rupN python-pillow-Pillow-4a8471d/Tests/test_file_png.py python-pillow-Pillow-4a8471d-new/Tests/test_file_png.py
---- python-pillow-Pillow-4a8471d/Tests/test_file_png.py 2014-10-13 19:13:17.000000000 +0200
-+++ python-pillow-Pillow-4a8471d-new/Tests/test_file_png.py 2015-01-12 18:00:52.625295615 +0100
-@@ -153,7 +153,7 @@ class TestFilePng(PillowTestCase):
-
- im = load(HEAD + chunk(b'iTXt', b'spam\0\1\0en\0Spam\0' +
- zlib.compress(b"egg")[:1]) + TAIL)
-- self.assertEqual(im.info, {})
-+ self.assertEqual(im.info, {'spam':''})
-
- im = load(HEAD + chunk(b'iTXt', b'spam\0\1\1en\0Spam\0' +
- zlib.compress(b"egg")) + TAIL)
diff --git a/python-pillow_PySequence_Fast_GET_ITEM.patch b/python-pillow_PySequence_Fast_GET_ITEM.patch
new file mode 100644
index 0000000..8ac2922
--- /dev/null
+++ b/python-pillow_PySequence_Fast_GET_ITEM.patch
@@ -0,0 +1,58 @@
+From f75c5562c7a6a887bdcb8c7f93022fa1fdfcee09 Mon Sep 17 00:00:00 2001
+From: wiredfool <eric-github at soroos.net>
+Date: Thu, 13 Nov 2014 14:56:59 -0800
+Subject: [PATCH] Fix #1008, Correct argument to PySequence_Fast_GET_ITEM
+
+---
+ _imaging.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/_imaging.c b/_imaging.c
+index f7ea510..28ac460 100644
+--- a/_imaging.c
++++ b/_imaging.c
+@@ -1269,7 +1269,7 @@ _putdata(ImagingObject* self, PyObject* args)
+ if (scale == 1.0 && offset == 0.0) {
+ /* Clipped data */
+ for (i = x = y = 0; i < n; i++) {
+- op = PySequence_Fast_GET_ITEM(data, i);
++ op = PySequence_Fast_GET_ITEM(seq, i);
+ image->image8[y][x] = (UINT8) CLIP(PyInt_AsLong(op));
+ if (++x >= (int) image->xsize){
+ x = 0, y++;
+@@ -1279,7 +1279,7 @@ _putdata(ImagingObject* self, PyObject* args)
+ } else {
+ /* Scaled and clipped data */
+ for (i = x = y = 0; i < n; i++) {
+- PyObject *op = PySequence_Fast_GET_ITEM(data, i);
++ PyObject *op = PySequence_Fast_GET_ITEM(seq, i);
+ image->image8[y][x] = CLIP(
+ (int) (PyFloat_AsDouble(op) * scale + offset));
+ if (++x >= (int) image->xsize){
+@@ -1299,7 +1299,7 @@ _putdata(ImagingObject* self, PyObject* args)
+ switch (image->type) {
+ case IMAGING_TYPE_INT32:
+ for (i = x = y = 0; i < n; i++) {
+- op = PySequence_Fast_GET_ITEM(data, i);
++ op = PySequence_Fast_GET_ITEM(seq, i);
+ IMAGING_PIXEL_INT32(image, x, y) =
+ (INT32) (PyFloat_AsDouble(op) * scale + offset);
+ if (++x >= (int) image->xsize){
+@@ -1310,7 +1310,7 @@ _putdata(ImagingObject* self, PyObject* args)
+ break;
+ case IMAGING_TYPE_FLOAT32:
+ for (i = x = y = 0; i < n; i++) {
+- op = PySequence_Fast_GET_ITEM(data, i);
++ op = PySequence_Fast_GET_ITEM(seq, i);
+ IMAGING_PIXEL_FLOAT32(image, x, y) =
+ (FLOAT32) (PyFloat_AsDouble(op) * scale + offset);
+ if (++x >= (int) image->xsize){
+@@ -1326,7 +1326,7 @@ _putdata(ImagingObject* self, PyObject* args)
+ INT32 inkint;
+ } u;
+
+- op = PySequence_Fast_GET_ITEM(data, i);
++ op = PySequence_Fast_GET_ITEM(seq, i);
+ if (!op || !getink(op, image, u.ink)) {
+ return NULL;
+ }
diff --git a/sources b/sources
index 7c7c159..d46d2e5 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-33b5bdbaee9ab21301741d23af0c4b03 python-pillow-Pillow-2.6.1-0-g4a8471d.tar.gz
+cba66413bacc9f8b54c4a8adf19ec1f9 python-pillow-Pillow-2.6.2-0-g9f0ec3b.tar.gz
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/python-pillow.git/commit/?h=f21&id=2c5847c70c7622e684b9fbb9f08a8830a23df5e4
More information about the scm-commits
mailing list