|
|
e9ca13 |
From cf4753691dc55999373d1c576f62ecb298723420 Mon Sep 17 00:00:00 2001
|
|
|
e9ca13 |
From: Remi Collet <remi@php.net>
|
|
|
e9ca13 |
Date: Mon, 4 Aug 2014 10:42:39 +0200
|
|
|
e9ca13 |
Subject: [PATCH] Fixed Bug #66901 php-gd 'c_color' NULL pointer dereference
|
|
|
e9ca13 |
|
|
|
e9ca13 |
Upstream https://bitbucket.org/libgd/gd-libgd/commits/463c3bd09bfe8e924e19acad7a2a6af16953a704
|
|
|
e9ca13 |
|
|
|
e9ca13 |
Notice: this fix don't manage monochrome/monovisual values
|
|
|
e9ca13 |
but just fix the security issue CVE-2014-2497
|
|
|
e9ca13 |
failing when trying to load such an image
|
|
|
e9ca13 |
---
|
|
|
e9ca13 |
ext/gd/libgd/gdxpm.c | 7 ++++++-
|
|
|
e9ca13 |
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
e9ca13 |
|
|
|
e9ca13 |
diff --git a/ext/gd/libgd/gdxpm.c b/ext/gd/libgd/gdxpm.c
|
|
|
e9ca13 |
index 73f86e5..b69414e 100644
|
|
|
e9ca13 |
--- a/ext/gd/libgd/gdxpm.c
|
|
|
e9ca13 |
+++ b/ext/gd/libgd/gdxpm.c
|
|
|
e9ca13 |
@@ -31,12 +31,17 @@ gdImagePtr gdImageCreateFromXpm (char *filename)
|
|
|
e9ca13 |
if (ret != XpmSuccess) {
|
|
|
e9ca13 |
return 0;
|
|
|
e9ca13 |
}
|
|
|
e9ca13 |
+ number = image.ncolors;
|
|
|
e9ca13 |
+ for(i = 0; i < number; i++) {
|
|
|
e9ca13 |
+ if (!image.colorTable[i].c_color) {
|
|
|
e9ca13 |
+ goto done;
|
|
|
e9ca13 |
+ }
|
|
|
e9ca13 |
+ }
|
|
|
e9ca13 |
|
|
|
e9ca13 |
if (!(im = gdImageCreate(image.width, image.height))) {
|
|
|
e9ca13 |
goto done;
|
|
|
e9ca13 |
}
|
|
|
e9ca13 |
|
|
|
e9ca13 |
- number = image.ncolors;
|
|
|
e9ca13 |
colors = (int *) safe_emalloc(number, sizeof(int), 0);
|
|
|
e9ca13 |
for (i = 0; i < number; i++) {
|
|
|
e9ca13 |
switch (strlen (image.colorTable[i].c_color)) {
|
|
|
e9ca13 |
--
|
|
|
e9ca13 |
1.9.2
|
|
|
e9ca13 |
|