Merge pull request #782 from wiredfool/32bit_decompression

32bit mult overflow fix
This commit is contained in:
Hugo 2014-07-07 19:25:39 +03:00
commit 3ad62fa7fc
3 changed files with 11 additions and 2 deletions

View File

@ -0,0 +1,7 @@
#!/usr/bin/env python
from PIL import Image
im = Image.new('L', (999999, 999999), 0)

View File

@ -69,4 +69,6 @@
#define FLOAT32 float
#define FLOAT64 double
#ifdef _MSC_VER
typedef signed __int64 int64_t;
#endif

View File

@ -379,7 +379,7 @@ ImagingNew(const char* mode, int xsize, int ysize)
} else
bytes = strlen(mode); /* close enough */
if ((Py_ssize_t) xsize * ysize * bytes <= THRESHOLD) {
if ((int64_t) xsize * (int64_t) ysize * bytes <= THRESHOLD) {
im = ImagingNewBlock(mode, xsize, ysize);
if (im)
return im;