blob: d414bc9a7dfd27fe1b839a802d011247a361f6de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
$NetBSD: patch-ext_gd_libgd_gdxpm.c,v 1.1.2.2 2014/06/01 13:20:22 spz Exp $
Patch to fix CVE-2014-2497, taken from
https://bugs.php.net/patch-display.php?bug_id=66901
--- ext/gd/libgd/gdxpm.c.orig 2014-04-29 08:04:30.000000000 +0000
+++ ext/gd/libgd/gdxpm.c
@@ -39,6 +39,13 @@ gdImagePtr gdImageCreateFromXpm (char *f
number = image.ncolors;
colors = (int *) safe_emalloc(number, sizeof(int), 0);
for (i = 0; i < number; i++) {
+ if (!image.colorTable[i].c_color)
+ {
+ /* unsupported color key or color key not defined */
+ gdImageDestroy(im);
+ im = 0;
+ goto done;
+ }
switch (strlen (image.colorTable[i].c_color)) {
case 4:
buf[1] = '\0';
@@ -125,8 +132,8 @@ gdImagePtr gdImageCreateFromXpm (char *f
}
}
- gdFree(colors);
done:
+ gdFree(colors);
XpmFreeXpmImage(&image);
XpmFreeXpmInfo(&info);
return im;
|