mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-04 11:53:32 +03:00
Avoid division by zero
This commit is contained in:
parent
0764b2b5e9
commit
a662443b7f
2
map.c
2
map.c
|
@ -342,7 +342,7 @@ PyImaging_MapBuffer(PyObject* self, PyObject* args)
|
||||||
stride = xsize * 4;
|
stride = xsize * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ysize > INT_MAX / stride) {
|
if (stride > 0 && ysize > INT_MAX / stride) {
|
||||||
PyErr_SetString(PyExc_MemoryError, "Integer overflow in ysize");
|
PyErr_SetString(PyExc_MemoryError, "Integer overflow in ysize");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user