Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1161d20548 | ||
|
|
c8b2985416 | ||
|
|
b096fcc20f | ||
|
|
2e1a3c29aa | ||
|
|
51a3193b38 | ||
|
|
3d2e407de7 | ||
|
|
6eb8d2c4c2 |
24
CHANGES.rst
24
CHANGES.rst
@ -1,6 +1,23 @@
|
||||
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)
|
||||
------------------
|
||||
|
||||
@ -127,6 +144,13 @@ Changelog (Pillow)
|
||||
- Retain a reference to core image object in PyAccess #2009
|
||||
[homm]
|
||||
|
||||
3.3.3 (2016-10-04)
|
||||
------------------
|
||||
|
||||
- Fix fix for map.c overflow #2151
|
||||
[wiredfool]
|
||||
|
||||
|
||||
3.3.2 (2016-10-03)
|
||||
------------------
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
# ;-)
|
||||
|
||||
VERSION = '1.1.7' # PIL version
|
||||
PILLOW_VERSION = '3.4.0' # Pillow
|
||||
PILLOW_VERSION = '3.4.2' # Pillow
|
||||
|
||||
__version__ = PILLOW_VERSION
|
||||
|
||||
|
||||
@ -336,6 +336,17 @@ class CoreResampleCoefficientsTest(PillowTestCase):
|
||||
self.assertEqual(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__':
|
||||
unittest.main()
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
* 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"
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
version: 3.4.0.{build}
|
||||
version: 3.4.2.{build}
|
||||
clone_folder: c:\pillow
|
||||
init:
|
||||
- ECHO %PYTHON%
|
||||
|
||||
@ -176,18 +176,23 @@ precompute_coeffs(int inSize, int outSize, struct filter *filterp,
|
||||
k = &kk[xx * kmax];
|
||||
for (x = 0; x < xmax; x++) {
|
||||
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) {
|
||||
// Skip from the start.
|
||||
if (x == 0) {
|
||||
// At next loop `x` will be 0.
|
||||
x -= 1;
|
||||
// But `w` will not be 0, because it based on `xmin`.
|
||||
xmin += 1;
|
||||
xmax -= 1;
|
||||
} else if (x == xmax - 1) {
|
||||
// Truncate the last coefficient for current `xx`.
|
||||
xmax -= 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
k[x] = w;
|
||||
ww += w;
|
||||
}
|
||||
for (x = 0; x < xmax; x++) {
|
||||
if (ww != 0.0)
|
||||
|
||||
2
map.c
2
map.c
@ -349,7 +349,7 @@ PyImaging_MapBuffer(PyObject* self, PyObject* args)
|
||||
|
||||
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");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user