mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 01:34:24 +03:00
adding an upper limit for blocks_max in _set_blocks_max
This commit is contained in:
parent
ea570a8c5b
commit
37516fb665
|
@ -3625,6 +3625,12 @@ _set_blocks_max(PyObject* self, PyObject* args)
|
|||
"blocks_max should be greater than 0");
|
||||
return NULL;
|
||||
}
|
||||
else if ( blocks_max > SIZE_MAX/sizeof(ImagingDefaultArena.blocks_pool[0])) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"blocks_max is too large");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if ( ! ImagingMemorySetBlocksMax(&ImagingDefaultArena, blocks_max)) {
|
||||
ImagingError_MemoryError();
|
||||
|
|
Loading…
Reference in New Issue
Block a user