Fixed Bug #66901 php-gd 'c_color' NULL pointer dereference

Upstream 463c3bd09b

Notice: this fix don't manage monochrome/monovisual values
but just fix the security issue CVE-2014-2497
failing when trying to load such an image
This commit is contained in:
Remi Collet 2014-08-04 10:42:39 +02:00
parent ae74549239
commit cf4753691d

View File

@ -31,12 +31,17 @@ gdImagePtr gdImageCreateFromXpm (char *filename)
if (ret != XpmSuccess) {
return 0;
}
number = image.ncolors;
for(i = 0; i < number; i++) {
if (!image.colorTable[i].c_color) {
goto done;
}
}
if (!(im = gdImageCreate(image.width, image.height))) {
goto done;
}
number = image.ncolors;
colors = (int *) safe_emalloc(number, sizeof(int), 0);
for (i = 0; i < number; i++) {
switch (strlen (image.colorTable[i].c_color)) {