destroy image and set MemoryError on overflow check failure

This commit is contained in:
Alexander 2017-08-06 00:50:56 +03:00
parent 6b50ba07fd
commit eafa258bd1

View File

@ -344,7 +344,8 @@ ImagingNewBlock(const char *mode, int xsize, int ysize)
if (im->linesize &&
im->ysize > INT_MAX / im->linesize) {
/* punt if we're going to overflow */
return NULL;
ImagingDelete(im);
return (Imaging) ImagingError_MemoryError();
}
if (im->ysize * im->linesize <= 0) {