Fix possible integer overflow

This commit is contained in:
cgohlke 2019-01-25 15:11:22 -08:00 committed by GitHub
parent 74ce856515
commit 86afcfd8f9
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;
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");
return NULL;
}