From 3ffcd9770cef435e10b0a5890d36501d1153e729 Mon Sep 17 00:00:00 2001 From: Lukasz Kozuchowski Date: Sun, 29 Jan 2017 07:20:44 +0100 Subject: [PATCH] BUG fix: '' in image mode no longer causes a crash --- libImaging/Storage.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libImaging/Storage.c b/libImaging/Storage.c index 27661bfdb..fb27572d3 100644 --- a/libImaging/Storage.c +++ b/libImaging/Storage.c @@ -398,6 +398,9 @@ ImagingNew(const char* mode, int xsize, int ysize) int bytes; Imaging im; + if (strcmp(mode, "") == 0) + return (Imaging) ImagingError_ValueError("empty mode"); + if (strlen(mode) == 1) { if (mode[0] == 'F' || mode[0] == 'I') bytes = 4;