Avoid division by zero

This commit is contained in:
hugovk 2017-02-22 08:28:20 +02:00
parent 0764b2b5e9
commit a662443b7f

2
map.c
View File

@ -342,7 +342,7 @@ PyImaging_MapBuffer(PyObject* self, PyObject* args)
stride = xsize * 4;
}
if (ysize > INT_MAX / stride) {
if (stride > 0 && ysize > INT_MAX / stride) {
PyErr_SetString(PyExc_MemoryError, "Integer overflow in ysize");
return NULL;
}