summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuli Suominen <drac@gentoo.org>2007-02-05 19:27:27 +0000
committerSamuli Suominen <drac@gentoo.org>2007-02-05 19:27:27 +0000
commitc4ad462f10d443eab0dd5860908061df7ef6ef82 (patch)
treead36cbf1bb6216d59b7cc300a61b87ea01355dc3 /media-libs
parentStable on ppc wrt bug #162039. (diff)
downloadgentoo-2-c4ad462f10d443eab0dd5860908061df7ef6ef82.tar.gz
gentoo-2-c4ad462f10d443eab0dd5860908061df7ef6ef82.tar.bz2
gentoo-2-c4ad462f10d443eab0dd5860908061df7ef6ef82.zip
Fix fix for 3425, sed call was outdated. Remove USE static. Fix autotools handling. Fix documentation installation. Clean up. Will be unmasked soon, running some tests.
Diffstat (limited to 'media-libs')
-rw-r--r--media-libs/imlib/ChangeLog9
-rw-r--r--media-libs/imlib/Manifest23
-rw-r--r--media-libs/imlib/files/digest-imlib-1.9.15-r13
-rw-r--r--media-libs/imlib/files/imlib-1.9.15.patch47
-rw-r--r--media-libs/imlib/files/imlib-security.patch510
-rw-r--r--media-libs/imlib/imlib-1.9.15-r1.ebuild53
6 files changed, 640 insertions, 5 deletions
diff --git a/media-libs/imlib/ChangeLog b/media-libs/imlib/ChangeLog
index 9d025ce94b29..35eb5c249e26 100644
--- a/media-libs/imlib/ChangeLog
+++ b/media-libs/imlib/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for media-libs/imlib
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-libs/imlib/ChangeLog,v 1.40 2007/01/19 21:37:57 dang Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-libs/imlib/ChangeLog,v 1.41 2007/02/05 19:27:27 drac Exp $
+
+*imlib-1.9.15-r1 (05 Feb 2007)
+
+ 05 Feb 2007; Samuli Suominen <drac@gentoo.org> +files/imlib-1.9.15.patch,
+ +files/imlib-security.patch, +imlib-1.9.15-r1.ebuild:
+ Fix fix for 3425, sed call was outdated. Remove USE static. Fix autotools
+ handling. Fix documentation installation. Clean up.
19 Jan 2007; Daniel Gryniewicz <dang@gentoo.org> metadata.xml:
Gnome herd doesn't want to maintain this anymore
diff --git a/media-libs/imlib/Manifest b/media-libs/imlib/Manifest
index dd517902ebc6..459b6e7556b3 100644
--- a/media-libs/imlib/Manifest
+++ b/media-libs/imlib/Manifest
@@ -14,20 +14,32 @@ AUX imlib-1.9.15-gdk_flag.patch 888 RMD160 9ea1c287e3b24b9b29262d416fe5aa2739c7a
MD5 2d810b6b736520a0b248a989e9195a9e files/imlib-1.9.15-gdk_flag.patch 888
RMD160 9ea1c287e3b24b9b29262d416fe5aa2739c7a1a9 files/imlib-1.9.15-gdk_flag.patch 888
SHA256 971e2971a23a627c389769b5c164bdd9d1bd3644e4ab1b1929982080a16e0dee files/imlib-1.9.15-gdk_flag.patch 888
+AUX imlib-1.9.15.patch 1535 RMD160 594d0a5126cf774e8aeeb8d25ad00594292c24da SHA1 27a6255c794c7aad41bc15c592763600f72b64c4 SHA256 4b4cc8a46be7b7a9f6215bf1eb8668182efad1379eb8aacf1ecd00b5f2cb9205
+MD5 83fb6e1e6f1df0841c3dbe5a6b8b338e files/imlib-1.9.15.patch 1535
+RMD160 594d0a5126cf774e8aeeb8d25ad00594292c24da files/imlib-1.9.15.patch 1535
+SHA256 4b4cc8a46be7b7a9f6215bf1eb8668182efad1379eb8aacf1ecd00b5f2cb9205 files/imlib-1.9.15.patch 1535
+AUX imlib-security.patch 13040 RMD160 432377938bd85f9974bff8f08aca6d93d310057c SHA1 ec1b47281c1a7fb21abe841f948ecc56ed13f310 SHA256 d67a7faa2dba8d361cf25b6fc8125c1da92f25b612bffe909daacdeda577dd57
+MD5 b273d36aa60adbfaacaf6062234e4c1f files/imlib-security.patch 13040
+RMD160 432377938bd85f9974bff8f08aca6d93d310057c files/imlib-security.patch 13040
+SHA256 d67a7faa2dba8d361cf25b6fc8125c1da92f25b612bffe909daacdeda577dd57 files/imlib-security.patch 13040
DIST imlib-1.9.14.tar.bz2 587947 RMD160 363a9ef22e533b8714dc72ac06a25314860b7c4c SHA1 92eb60b4b45443d6ab5ed2e4672808c91845ab9d SHA256 0bee75cf9e751953156e1b9b82aad27c349269206aa8b27b3c0145dbbc70d4a7
DIST imlib-1.9.15.tar.bz2 683242 RMD160 195b80833167134ba2d9a9574d420279f9cf55f4 SHA1 c9a732a354fbb3c7e1a426e5d19fc92d73f8f720 SHA256 4e6a270308a9ae16586bfc133c1a3dfb2e56f431edb66aaa3a80e36e5ed84ce0
EBUILD imlib-1.9.14-r3.ebuild 1175 RMD160 15f1eb7d2f4c85b8896c5f6cca6ac2dc13539661 SHA1 dd8eda879a46b4536c222734def79ea71be74c4a SHA256 17051b7460eeec3c99c66284767a53088406b0aab6910ca725f2ee5513c355a4
MD5 2abf42be490d9c3fd86ded8a9c7366cd imlib-1.9.14-r3.ebuild 1175
RMD160 15f1eb7d2f4c85b8896c5f6cca6ac2dc13539661 imlib-1.9.14-r3.ebuild 1175
SHA256 17051b7460eeec3c99c66284767a53088406b0aab6910ca725f2ee5513c355a4 imlib-1.9.14-r3.ebuild 1175
+EBUILD imlib-1.9.15-r1.ebuild 1220 RMD160 02a8c83cadc43d2b1b179c9a09ed21e7bfc92d6d SHA1 888fda37bb32a7df9acde433d680b621a549ef94 SHA256 54a2d5185751786c9cd7b888583f47d733d4c775ffb5632130ba0727419a7832
+MD5 60969d3bd881df77f5ce28d50ce3bcc8 imlib-1.9.15-r1.ebuild 1220
+RMD160 02a8c83cadc43d2b1b179c9a09ed21e7bfc92d6d imlib-1.9.15-r1.ebuild 1220
+SHA256 54a2d5185751786c9cd7b888583f47d733d4c775ffb5632130ba0727419a7832 imlib-1.9.15-r1.ebuild 1220
EBUILD imlib-1.9.15.ebuild 1800 RMD160 6e1ef60b3ad6ffbfa83d9e676b5b9db1d7ef9e72 SHA1 9e9c406a06a465eba4cdad29e1c96b56e6042e7a SHA256 295183b7810ee8dd252e22fc6c7d9ebf2a898f9bd6add1654a04fd3d6fbcf10e
MD5 eee2e020af96b3b5dfb189f91ea911c5 imlib-1.9.15.ebuild 1800
RMD160 6e1ef60b3ad6ffbfa83d9e676b5b9db1d7ef9e72 imlib-1.9.15.ebuild 1800
SHA256 295183b7810ee8dd252e22fc6c7d9ebf2a898f9bd6add1654a04fd3d6fbcf10e imlib-1.9.15.ebuild 1800
-MISC ChangeLog 5578 RMD160 0133f64f7a6ad570211be52261a7c9f6a642440f SHA1 193644617e16cf4248f362f98d12ef8952f1c882 SHA256 5520b97aeb4e6186ae84c1b5acde4299080dfb7a7df2850d496bf8918fa9f571
-MD5 10acf337b2ddda202539c896fab719cf ChangeLog 5578
-RMD160 0133f64f7a6ad570211be52261a7c9f6a642440f ChangeLog 5578
-SHA256 5520b97aeb4e6186ae84c1b5acde4299080dfb7a7df2850d496bf8918fa9f571 ChangeLog 5578
+MISC ChangeLog 5873 RMD160 e4eac47b095de2e2959db0125279ab8725299fc2 SHA1 893c341e5a2fb485050af93c3617a47bfcfa8ed1 SHA256 cd4c125d33299eda9bca1c537d8fcbf22445da2c8cb73f3515ebf349901b290a
+MD5 8d5a0639ffe8c5a887afc8ea69fb711d ChangeLog 5873
+RMD160 e4eac47b095de2e2959db0125279ab8725299fc2 ChangeLog 5873
+SHA256 cd4c125d33299eda9bca1c537d8fcbf22445da2c8cb73f3515ebf349901b290a ChangeLog 5873
MISC metadata.xml 223 RMD160 2fff04beb8d1d190f0ade4a52bb13e3b29af65cb SHA1 a91cab263e44718b8d7e8e33c7aca01b2b4032e9 SHA256 b589c118502c8401bcc833956c80ac3cdb0e484a332e7509a332352721a9f8c6
MD5 1e889c7f863a0fc30caf92bce27a25d3 metadata.xml 223
RMD160 2fff04beb8d1d190f0ade4a52bb13e3b29af65cb metadata.xml 223
@@ -38,3 +50,6 @@ SHA256 428e5761ccd271e004869673db035c46d40c623d7d90f262911706b0d9888132 files/di
MD5 3ca74ed1d09e760b3ba65e3ea3f0c88d files/digest-imlib-1.9.15 241
RMD160 039218e55a8fed0fb8c45920058885c1d84c22df files/digest-imlib-1.9.15 241
SHA256 79835fd763b99e818f64104e0bf5f475c9dc57a629506db65b9694b4eec1c997 files/digest-imlib-1.9.15 241
+MD5 3ca74ed1d09e760b3ba65e3ea3f0c88d files/digest-imlib-1.9.15-r1 241
+RMD160 039218e55a8fed0fb8c45920058885c1d84c22df files/digest-imlib-1.9.15-r1 241
+SHA256 79835fd763b99e818f64104e0bf5f475c9dc57a629506db65b9694b4eec1c997 files/digest-imlib-1.9.15-r1 241
diff --git a/media-libs/imlib/files/digest-imlib-1.9.15-r1 b/media-libs/imlib/files/digest-imlib-1.9.15-r1
new file mode 100644
index 000000000000..52c816f8266d
--- /dev/null
+++ b/media-libs/imlib/files/digest-imlib-1.9.15-r1
@@ -0,0 +1,3 @@
+MD5 7db987e6c52e4daf70d7d0f471238eae imlib-1.9.15.tar.bz2 683242
+RMD160 195b80833167134ba2d9a9574d420279f9cf55f4 imlib-1.9.15.tar.bz2 683242
+SHA256 4e6a270308a9ae16586bfc133c1a3dfb2e56f431edb66aaa3a80e36e5ed84ce0 imlib-1.9.15.tar.bz2 683242
diff --git a/media-libs/imlib/files/imlib-1.9.15.patch b/media-libs/imlib/files/imlib-1.9.15.patch
new file mode 100644
index 000000000000..ac6de5a67981
--- /dev/null
+++ b/media-libs/imlib/files/imlib-1.9.15.patch
@@ -0,0 +1,47 @@
+diff -ur imlib-1.9.15.orig/configure.in imlib-1.9.15/configure.in
+--- imlib-1.9.15.orig/configure.in 2004-09-23 04:13:45.000000000 +0300
++++ imlib-1.9.15/configure.in 2007-02-05 20:10:48.000000000 +0200
+@@ -17,10 +17,20 @@
+ dnl incase it is broken for example.
+ AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]], echo $enable_shm, enable_shm="yes")
+
+-AM_PATH_GTK(1.2.1,[
+- GDK_IMLIB="gdk_imlib utils"],[
+- GDK_IMLIB=""
+- AC_MSG_WARN([*** gdk_imlib will not be built ***])])
++AC_ARG_ENABLE(gdk, [ --enable-gdk enable gdk_imlib compilation [default=yes]],[
++ if test x$enableval = xyes; then
++ disable_gdk="no"
++ else
++ disable_gdk="yes"
++ fi],disable_gdk=no)
++
++if test x$disable_gdk = xno; then
++ AC_MSG_RESULT(no)
++ GDK_IMLIB="gdk_imlib utils"
++else
++ AC_MSG_RESULT(yes)
++ GDK_IMLIB=""
++fi
+
+ AC_MSG_CHECKING(whether to build gmodulized imlib)
+
+diff -ur imlib-1.9.15.orig/imlib-config.in imlib-1.9.15/imlib-config.in
+--- imlib-1.9.15.orig/imlib-config.in 2004-08-27 19:03:11.000000000 +0300
++++ imlib-1.9.15/imlib-config.in 2007-02-05 20:59:43.000000000 +0200
+@@ -46,15 +46,9 @@
+ echo @VERSION@
+ ;;
+ --cflags)
+- if test @includedir@ != /usr/include ; then
+- includes=-I@includedir@
+- fi
+ echo $includes @X_CFLAGS@
+ ;;
+ --cflags-gdk)
+- if test @includedir@ != /usr/include ; then
+- includes=-I@includedir@
+- fi
+ echo `@GTK_CONFIG@ --cflags` $includes @X_CFLAGS@
+ ;;
+ --libs)
diff --git a/media-libs/imlib/files/imlib-security.patch b/media-libs/imlib/files/imlib-security.patch
new file mode 100644
index 000000000000..c820270d47e1
--- /dev/null
+++ b/media-libs/imlib/files/imlib-security.patch
@@ -0,0 +1,510 @@
+diff -urN imlib-1.9.13.orig/Imlib/load.c imlib-1.9.13/Imlib/load.c
+--- imlib-1.9.13.orig/Imlib/load.c Wed Mar 13 19:06:29 2002
++++ imlib-1.9.13/Imlib/load.c Thu Sep 16 17:21:01 2004
+@@ -4,6 +4,8 @@
+ #include "Imlib_private.h"
+ #include <setjmp.h>
+
++#define G_MAXINT ((int) 0x7fffffff)
++
+ /* Split the ID - damages input */
+
+ static char *
+@@ -41,13 +43,17 @@
+
+ /*
+ * Make sure we don't wrap on our memory allocations
++ * we check G_MAXINT/4 because rend.c malloc's w * h * bpp
++ * + 3 is safety margin
+ */
+
+ void * _imlib_malloc_image(unsigned int w, unsigned int h)
+ {
+- if( w > 32767 || h > 32767)
+- return NULL;
+- return malloc(w * h * 3);
++ if (w <= 0 || w > 32767 ||
++ h <= 0 || h > 32767 ||
++ h >= (G_MAXINT/4 - 1) / w)
++ return NULL;
++ return malloc(w * h * 3 + 3);
+ }
+
+ #ifdef HAVE_LIBJPEG
+@@ -360,7 +366,9 @@
+ npix = ww * hh;
+ *w = (int)ww;
+ *h = (int)hh;
+- if(ww > 32767 || hh > 32767)
++ if (ww <= 0 || ww > 32767 ||
++ hh <= 0 || hh > 32767 ||
++ hh >= (G_MAXINT/sizeof(uint32)) / ww)
+ {
+ TIFFClose(tif);
+ return NULL;
+@@ -463,7 +471,7 @@
+ }
+ *w = gif->Image.Width;
+ *h = gif->Image.Height;
+- if (*h > 32767 || *w > 32767)
++ if (*h <= 0 || *h > 32767 || *w <= 0 || *w > 32767)
+ {
+ return NULL;
+ }
+@@ -965,7 +973,12 @@
+ comment = 0;
+ quote = 0;
+ context = 0;
++ memset(lookup, 0, sizeof(lookup));
++
+ line = malloc(lsz);
++ if (!line)
++ return NULL;
++
+ while (!done)
+ {
+ pc = c;
+@@ -994,25 +1007,25 @@
+ {
+ /* Header */
+ sscanf(line, "%i %i %i %i", w, h, &ncolors, &cpp);
+- if (ncolors > 32766)
++ if (ncolors <= 0 || ncolors > 32766)
+ {
+ fprintf(stderr, "IMLIB ERROR: XPM files wth colors > 32766 not supported\n");
+ free(line);
+ return NULL;
+ }
+- if (cpp > 5)
++ if (cpp <= 0 || cpp > 5)
+ {
+ fprintf(stderr, "IMLIB ERROR: XPM files with characters per pixel > 5 not supported\n");
+ free(line);
+ return NULL;
+ }
+- if (*w > 32767)
++ if (*w <= 0 || *w > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image width > 32767 pixels for file\n");
+ free(line);
+ return NULL;
+ }
+- if (*h > 32767)
++ if (*h <= 0 || *h > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image height > 32767 pixels for file\n");
+ free(line);
+@@ -1045,11 +1058,13 @@
+ {
+ int slen;
+ int hascolor, iscolor;
++ int space;
+
+ iscolor = 0;
+ hascolor = 0;
+ tok[0] = 0;
+ col[0] = 0;
++ space = sizeof(col) - 1;
+ s[0] = 0;
+ len = strlen(line);
+ strncpy(cmap[j].str, line, cpp);
+@@ -1072,10 +1087,10 @@
+ {
+ if (k >= len)
+ {
+- if (col[0])
+- strcat(col, " ");
+- if (strlen(col) + strlen(s) < sizeof(col))
+- strcat(col, s);
++ if (col[0] && space > 0)
++ strcat(col, " "), space -= 1;
++ if (slen <= space)
++ strcat(col, s), space -= slen;
+ }
+ if (col[0])
+ {
+@@ -1105,14 +1120,17 @@
+ }
+ }
+ }
+- strcpy(tok, s);
++ if (slen < sizeof(tok));
++ strcpy(tok, s);
+ col[0] = 0;
++ space = sizeof(col) - 1;
+ }
+ else
+ {
+- if (col[0])
+- strcat(col, " ");
+- strcat(col, s);
++ if (col[0] && space > 0)
++ strcat(col, " "), space -=1;
++ if (slen <= space)
++ strcat(col, s), space -= slen;
+ }
+ }
+ }
+@@ -1341,12 +1359,12 @@
+ sscanf(s, "%i %i", w, h);
+ a = *w;
+ b = *h;
+- if (a > 32767)
++ if (a <= 0 || a > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image width > 32767 pixels for file\n");
+ return NULL;
+ }
+- if (b > 32767)
++ if (b <= 0 || b > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image height > 32767 pixels for file\n");
+ return NULL;
+diff -urN imlib-1.9.13.orig/Imlib/utils.c imlib-1.9.13/Imlib/utils.c
+--- imlib-1.9.13.orig/Imlib/utils.c Mon Mar 4 17:45:28 2002
++++ imlib-1.9.13/Imlib/utils.c Thu Sep 16 17:21:15 2004
+@@ -1496,36 +1496,56 @@
+ context = 0;
+ ptr = NULL;
+ end = NULL;
++ memset(lookup, 0, sizeof(lookup));
+
+ while (!done)
+ {
+ line = data[count++];
++ if (!line)
++ break;
++ line = strdup(line);
++ if (!line)
++ break;
++ len = strlen(line);
++ for (i = 0; i < len; ++i)
++ {
++ c = line[i];
++ if (c < 32)
++ line[i] = 32;
++ else if (c > 127)
++ line[i] = 127;
++ }
++
+ if (context == 0)
+ {
+ /* Header */
+ sscanf(line, "%i %i %i %i", &w, &h, &ncolors, &cpp);
+- if (ncolors > 32766)
++ if (ncolors <= 0 || ncolors > 32766)
+ {
+ fprintf(stderr, "IMLIB ERROR: XPM data wth colors > 32766 not supported\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (cpp > 5)
++ if (cpp <= 0 || cpp > 5)
+ {
+ fprintf(stderr, "IMLIB ERROR: XPM data with characters per pixel > 5 not supported\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (w > 32767)
++ if (w <= 0 || w > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image width > 32767 pixels for data\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (h > 32767)
++ if (h <= 0 || h > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image height > 32767 pixels for data\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+ cmap = malloc(sizeof(struct _cmap) * ncolors);
+@@ -1533,6 +1553,7 @@
+ if (!cmap)
+ {
+ free(im);
++ free(line);
+ return NULL;
+ }
+ im->rgb_width = w;
+@@ -1542,6 +1563,7 @@
+ {
+ free(cmap);
+ free(im);
++ free(line);
+ return NULL;
+ }
+ im->alpha_data = NULL;
+@@ -1817,6 +1839,7 @@
+ }
+ if ((ptr) && ((ptr - im->rgb_data) >= w * h * 3))
+ done = 1;
++ free(line);
+ }
+ if (!transp)
+ {
+diff -urN imlib-1.9.13.orig/gdk_imlib/io-gif.c imlib-1.9.13/gdk_imlib/io-gif.c
+--- imlib-1.9.13.orig/gdk_imlib/io-gif.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/io-gif.c Thu Sep 16 16:11:31 2004
+@@ -55,7 +55,7 @@
+ }
+ *w = gif->Image.Width;
+ *h = gif->Image.Height;
+- if(*h > 32767 || *w > 32767)
++ if(*h <= 0 || *h > 32767 || *w <= 0 || *w > 32767)
+ {
+ return NULL;
+ }
+diff -urN imlib-1.9.13.orig/gdk_imlib/io-ppm.c imlib-1.9.13/gdk_imlib/io-ppm.c
+--- imlib-1.9.13.orig/gdk_imlib/io-ppm.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/io-ppm.c Thu Sep 16 16:13:13 2004
+@@ -53,12 +53,12 @@
+ sscanf(s, "%i %i", w, h);
+ a = *w;
+ b = *h;
+- if (a > 32767)
++ if (a <= 0 || a > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image width > 32767 pixels for file\n");
+ return NULL;
+ }
+- if (b > 32767)
++ if (b <= 0 || b > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image height > 32767 pixels for file\n");
+ return NULL;
+diff -urN imlib-1.9.13.orig/gdk_imlib/io-tiff.c imlib-1.9.13/gdk_imlib/io-tiff.c
+--- imlib-1.9.13.orig/gdk_imlib/io-tiff.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/io-tiff.c Thu Sep 16 16:13:57 2004
+@@ -36,7 +36,9 @@
+ npix = ww * hh;
+ *w = (int)ww;
+ *h = (int)hh;
+- if(ww > 32767 || hh > 32767)
++ if (ww <= 0 || ww > 32767 ||
++ hh <= 0 || hh > 32767 ||
++ hh >= (G_MAXINT/sizeof(uint32)) / ww)
+ {
+ TIFFClose(tif);
+ return NULL;
+diff -urN imlib-1.9.13.orig/gdk_imlib/io-xpm.c imlib-1.9.13/gdk_imlib/io-xpm.c
+--- imlib-1.9.13.orig/gdk_imlib/io-xpm.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/io-xpm.c Thu Sep 16 17:08:24 2004
+@@ -40,8 +40,12 @@
+ context = 0;
+ i = j = 0;
+ cmap = NULL;
++ memset(lookup, 0, sizeof(lookup));
+
+ line = malloc(lsz);
++ if (!line)
++ return NULL;
++
+ while (!done)
+ {
+ pc = c;
+@@ -70,25 +74,25 @@
+ {
+ /* Header */
+ sscanf(line, "%i %i %i %i", w, h, &ncolors, &cpp);
+- if (ncolors > 32766)
++ if (ncolors <= 0 || ncolors > 32766)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: XPM files wth colors > 32766 not supported\n");
+ free(line);
+ return NULL;
+ }
+- if (cpp > 5)
++ if (cpp <= 0 || cpp > 5)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: XPM files with characters per pixel > 5 not supported\n");
+ free(line);
+ return NULL;
+ }
+- if (*w > 32767)
++ if (*w <= 0 || *w > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image width > 32767 pixels for file\n");
+ free(line);
+ return NULL;
+ }
+- if (*h > 32767)
++ if (*h <= 0 || *h > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image height > 32767 pixels for file\n");
+ free(line);
+@@ -120,11 +124,13 @@
+ {
+ int slen;
+ int hascolor, iscolor;
++ int space;
+
+ hascolor = 0;
+ iscolor = 0;
+ tok[0] = 0;
+ col[0] = 0;
++ space = sizeof(col) - 1;
+ s[0] = 0;
+ len = strlen(line);
+ strncpy(cmap[j].str, line, cpp);
+@@ -147,10 +153,10 @@
+ {
+ if (k >= len)
+ {
+- if (col[0])
+- strcat(col, " ");
+- if (strlen(col) + strlen(s) < sizeof(col))
+- strcat(col, s);
++ if (col[0] && space > 0)
++ strncat(col, " ", space), space -= 1;
++ if (slen <= space)
++ strcat(col, s), space -= slen;
+ }
+ if (col[0])
+ {
+@@ -180,14 +186,17 @@
+ }
+ }
+ }
+- strcpy(tok, s);
++ if (slen < sizeof(tok))
++ strcpy(tok, s);
+ col[0] = 0;
++ space = sizeof(col) - 1;
+ }
+ else
+ {
+- if (col[0])
+- strcat(col, " ");
+- strcat(col, s);
++ if (col[0] && space > 0)
++ strcat(col, " "), space -= 1;
++ if (slen <= space)
++ strcat(col, s), space -= slen;
+ }
+ }
+ }
+diff -urN imlib-1.9.13.orig/gdk_imlib/misc.c imlib-1.9.13/gdk_imlib/misc.c
+--- imlib-1.9.13.orig/gdk_imlib/misc.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/misc.c Thu Sep 16 16:35:32 2004
+@@ -1355,11 +1355,16 @@
+
+ /*
+ * Make sure we don't wrap on our memory allocations
++ * we check G_MAX_INT/4 because rend.c malloc's w * h * bpp
++ * + 3 is safety margin
+ */
+
+ void *_gdk_malloc_image(unsigned int w, unsigned int h)
+ {
+- if( w > 32767 || h > 32767)
++ if (w <= 0 || w > 32767 ||
++ h <= 0 || h > 32767 ||
++ h >= (G_MAXINT/4 - 1) / w)
+ return NULL;
+- return malloc(w * h * 3);
++ return malloc(w * h * 3 + 3);
+ }
++
+diff -urN imlib-1.9.13.orig/gdk_imlib/utils.c imlib-1.9.13/gdk_imlib/utils.c
+--- imlib-1.9.13.orig/gdk_imlib/utils.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/utils.c Thu Sep 16 17:28:35 2004
+@@ -1236,36 +1236,56 @@
+ context = 0;
+ ptr = NULL;
+ end = NULL;
++ memset(lookup, 0, sizeof(lookup));
+
+ while (!done)
+ {
+ line = data[count++];
++ if (!line)
++ break;
++ line = strdup(line);
++ if (!line)
++ break;
++ len = strlen(line);
++ for (i = 0; i < len; ++i)
++ {
++ c = line[i];
++ if (c < 32)
++ line[i] = 32;
++ else if (c > 127)
++ line[i] = 127;
++ }
++
+ if (context == 0)
+ {
+ /* Header */
+ sscanf(line, "%i %i %i %i", &w, &h, &ncolors, &cpp);
+- if (ncolors > 32766)
++ if (ncolors <= 0 || ncolors > 32766)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: XPM data wth colors > 32766 not supported\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (cpp > 5)
++ if (cpp <= 0 || cpp > 5)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: XPM data with characters per pixel > 5 not supported\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (w > 32767)
++ if (w <= 0 || w > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image width > 32767 pixels for data\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (h > 32767)
++ if (h <= 0 || h > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image height > 32767 pixels for data\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+ cmap = malloc(sizeof(struct _cmap) * ncolors);
+@@ -1273,6 +1293,7 @@
+ if (!cmap)
+ {
+ free(im);
++ free(line);
+ return NULL;
+ }
+ im->rgb_width = w;
+@@ -1282,6 +1303,7 @@
+ {
+ free(cmap);
+ free(im);
++ free(line);
+ return NULL;
+ }
+ im->alpha_data = NULL;
+@@ -1355,7 +1377,7 @@
+ strcpy(col + colptr, " ");
+ colptr++;
+ }
+- if (colptr + ls <= sizeof(col))
++ if (colptr + ls < sizeof(col))
+ {
+ strcpy(col + colptr, s);
+ colptr += ls;
+@@ -1558,6 +1580,7 @@
+ }
+ if ((ptr) && ((ptr - im->rgb_data) >= w * h * 3))
+ done = 1;
++ free(line);
+ }
+ if (!transp)
+ {
diff --git a/media-libs/imlib/imlib-1.9.15-r1.ebuild b/media-libs/imlib/imlib-1.9.15-r1.ebuild
new file mode 100644
index 000000000000..97a579483d3e
--- /dev/null
+++ b/media-libs/imlib/imlib-1.9.15-r1.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/imlib/imlib-1.9.15-r1.ebuild,v 1.1 2007/02/05 19:27:27 drac Exp $
+
+inherit autotools eutils gnome.org
+
+DESCRIPTION="Image loading and rendering library"
+HOMEPAGE="http://www.enlightenment.org/Libraries/Imlib.html"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="doc gtk"
+
+RDEPEND="gtk? ( =x11-libs/gtk+-1.2* )
+ >=media-libs/tiff-3.5.5
+ >=media-libs/giflib-4.1.0
+ >=media-libs/libpng-1.2.1
+ >=media-libs/jpeg-6b"
+DEPEND="${RDEPEND}"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ # Fix aclocal underquoted definition warnings.
+ # Conditionalize gdk functions for bug 40453.
+ # Fix imlib-config for bug 3425.
+ epatch "${FILESDIR}"/${P}.patch
+
+ # Fix security bug 72681.
+ epatch "${FILESDIR}"/${PN}-security.patch
+
+ eautoreconf
+}
+
+src_compile() {
+ econf --sysconfdir=/etc/imlib \
+ $(use_enable gtk gdk) \
+ $(use_enable gtk gtktest)
+
+ emake || die "emake failed."
+}
+
+src_install() {
+ emake "DESTDIR=${D}" install || die "emake install failed."
+
+ dodoc AUTHORS ChangeLog README
+ use doc && dohtml doc/*
+
+ # Hack to avoid installing pkgconfig file.
+ use gtk || rm "${D}"/usr/lib*/pkgconfig/imlibgdk.pc
+}