Compare commits

...

7 Commits
main ... 3.4.x

Author SHA1 Message Date
wiredfool
1161d20548 3.4.2 Release version bump 2016-10-17 01:35:19 -07:00
wiredfool
c8b2985416 Update CHANGES.rst [ci skip] 2016-10-17 01:31:05 -07:00
Alexander Karpinsky
b096fcc20f Fix coefficients calculation (#2162)
Fix coefficients calculation

* test for regression

* detailed comments what is going on
prevent setting the `k[-1]` item

* more readable
2016-10-17 09:24:40 +01:00
wiredfool
2e1a3c29aa Update Changes.rst [ci skip] 2016-10-04 07:11:00 -07:00
wiredfool
51a3193b38 3.4.1 Release Version bump 2016-10-04 07:08:57 -07:00
wiredfool
3d2e407de7 Map.c check should be against PY_SSIZE_T_MAX (#2151) 2016-10-04 07:08:57 -07:00
wiredfool
6eb8d2c4c2 Updated Changes.rst [ci skip] 2016-10-04 07:08:57 -07:00
8 changed files with 48 additions and 8 deletions

View File

@ -1,6 +1,23 @@
Changelog (Pillow) Changelog (Pillow)
================== ==================
3.4.2 (2016-10-18)
------------------
- Fix Resample coefficient calculation #2161
[homm]
3.4.1 (2016-10-04)
------------------
- Allow lists as arguments for Image.new() #2149
[homm]
- Fix fix for map.c overflow #2151 (also in 3.3.3)
[wiredfool]
3.4.0 (2016-10-03) 3.4.0 (2016-10-03)
------------------ ------------------
@ -127,6 +144,13 @@ Changelog (Pillow)
- Retain a reference to core image object in PyAccess #2009 - Retain a reference to core image object in PyAccess #2009
[homm] [homm]
3.3.3 (2016-10-04)
------------------
- Fix fix for map.c overflow #2151
[wiredfool]
3.3.2 (2016-10-03) 3.3.2 (2016-10-03)
------------------ ------------------

View File

@ -12,7 +12,7 @@
# ;-) # ;-)
VERSION = '1.1.7' # PIL version VERSION = '1.1.7' # PIL version
PILLOW_VERSION = '3.4.0' # Pillow PILLOW_VERSION = '3.4.2' # Pillow
__version__ = PILLOW_VERSION __version__ = PILLOW_VERSION

View File

@ -336,6 +336,17 @@ class CoreResampleCoefficientsTest(PillowTestCase):
self.assertEqual(test_color // 2, px[2, 0]) self.assertEqual(test_color // 2, px[2, 0])
# print '\r>', size, test_color // 2, px[2, 0] # print '\r>', size, test_color // 2, px[2, 0]
def test_nonzero_coefficients(self):
# regression test for the wrong coefficients calculation
# due to bug https://github.com/python-pillow/Pillow/issues/2161
im = Image.new('RGBA', (1280, 1280), (0x20, 0x40, 0x60, 0xff))
histogram = im.resize((256, 256), Image.BICUBIC).histogram()
self.assertEqual(histogram[0x100 * 0 + 0x20], 0x10000) # first channel
self.assertEqual(histogram[0x100 * 1 + 0x40], 0x10000) # second channel
self.assertEqual(histogram[0x100 * 2 + 0x60], 0x10000) # third channel
self.assertEqual(histogram[0x100 * 3 + 0xff], 0x10000) # fourth channel
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

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 "3.4.0" #define PILLOW_VERSION "3.4.2"
#include "Python.h" #include "Python.h"

View File

@ -1,4 +1,4 @@
version: 3.4.0.{build} version: 3.4.2.{build}
clone_folder: c:\pillow clone_folder: c:\pillow
init: init:
- ECHO %PYTHON% - ECHO %PYTHON%

View File

@ -176,18 +176,23 @@ precompute_coeffs(int inSize, int outSize, struct filter *filterp,
k = &kk[xx * kmax]; k = &kk[xx * kmax];
for (x = 0; x < xmax; x++) { for (x = 0; x < xmax; x++) {
double w = filterp->filter((x + xmin - center + 0.5) * ss); double w = filterp->filter((x + xmin - center + 0.5) * ss);
k[x] = w;
ww += w;
// We can skip extreme coefficients if they are zeroes.
if (w == 0) { if (w == 0) {
// Skip from the start.
if (x == 0) { if (x == 0) {
// At next loop `x` will be 0.
x -= 1; x -= 1;
// But `w` will not be 0, because it based on `xmin`.
xmin += 1; xmin += 1;
xmax -= 1; xmax -= 1;
} else if (x == xmax - 1) { } else if (x == xmax - 1) {
// Truncate the last coefficient for current `xx`.
xmax -= 1; xmax -= 1;
} }
continue;
} }
k[x] = w;
ww += w;
} }
for (x = 0; x < xmax; x++) { for (x = 0; x < xmax; x++) {
if (ww != 0.0) if (ww != 0.0)

2
map.c
View File

@ -349,7 +349,7 @@ PyImaging_MapBuffer(PyObject* self, PyObject* args)
size = (Py_ssize_t) ysize * stride; size = (Py_ssize_t) ysize * stride;
if (offset > SIZE_MAX - size) { if (offset > PY_SSIZE_T_MAX - size) {
PyErr_SetString(PyExc_MemoryError, "Integer overflow in offset"); PyErr_SetString(PyExc_MemoryError, "Integer overflow in offset");
return NULL; return NULL;
} }

View File

@ -110,7 +110,7 @@ except (ImportError, OSError):
_tkinter = None _tkinter = None
NAME = 'Pillow' NAME = 'Pillow'
PILLOW_VERSION = '3.4.0' PILLOW_VERSION = '3.4.2'
JPEG_ROOT = None JPEG_ROOT = None
JPEG2K_ROOT = None JPEG2K_ROOT = None
ZLIB_ROOT = None ZLIB_ROOT = None