mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-14 05:36:48 +03:00
Merge pull request #3609 from cgohlke/patch-2
Fix possible integer overflow
This commit is contained in:
commit
b20cbe5299
|
@ -1420,7 +1420,7 @@ _putdata(ImagingObject* self, PyObject* args)
|
||||||
image = self->image;
|
image = self->image;
|
||||||
|
|
||||||
n = PyObject_Length(data);
|
n = PyObject_Length(data);
|
||||||
if (n > (Py_ssize_t) (image->xsize * image->ysize)) {
|
if (n > (Py_ssize_t)image->xsize * (Py_ssize_t)image->ysize) {
|
||||||
PyErr_SetString(PyExc_TypeError, "too many data entries");
|
PyErr_SetString(PyExc_TypeError, "too many data entries");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user