mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-30 09:53:39 +03:00
destroy image and set MemoryError on overflow check failure
This commit is contained in:
parent
6b50ba07fd
commit
eafa258bd1
|
@ -344,7 +344,8 @@ ImagingNewBlock(const char *mode, int xsize, int ysize)
|
||||||
if (im->linesize &&
|
if (im->linesize &&
|
||||||
im->ysize > INT_MAX / im->linesize) {
|
im->ysize > INT_MAX / im->linesize) {
|
||||||
/* punt if we're going to overflow */
|
/* punt if we're going to overflow */
|
||||||
return NULL;
|
ImagingDelete(im);
|
||||||
|
return (Imaging) ImagingError_MemoryError();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (im->ysize * im->linesize <= 0) {
|
if (im->ysize * im->linesize <= 0) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user