Merge pull request #3609 from cgohlke/patch-2

Fix possible integer overflow
This commit is contained in:
Hugo 2019-02-03 11:49:35 +02:00 committed by GitHub
commit b20cbe5299
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
} }