Merge pull request #5108 from cgohlke/patch-1

Fix dereferencing potential null pointer
This commit is contained in:
Andrew Murray 2020-12-22 08:26:48 +11:00 committed by GitHub
commit 0eddc82157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3179,6 +3179,10 @@ _draw_polygon(ImagingDrawObject* self, PyObject* args)
/* Copy list of vertices to array */
ixy = (int*) calloc(n, 2 * sizeof(int));
if (ixy == NULL) {
free(xy);
return ImagingError_MemoryError();
}
for (i = 0; i < n; i++) {
ixy[i+i] = (int) xy[i+i];