mirror of
https://github.com/php/php-src.git
synced 2025-01-26 13:44:22 +08:00
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:
parent
ae74549239
commit
cf4753691d
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user