Remove imlib1

It has become a patch spaghetti over the time and making it support newer version
of various graphics libraries will be a nightmare

It is time to say good bye to imlib1

With hat:	portmgr
Discussed with:	antoine
Approved by:	kwm
This commit is contained in:
Baptiste Daroussin 2014-12-25 19:07:25 +00:00
parent 7ae46e9b12
commit 5829c025b1
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=375595
13 changed files with 5 additions and 802 deletions

1
MOVED
View File

@ -7343,3 +7343,4 @@ japanese/xjtext||2014-12-25|Abandonware, depends on imlib
x11/peeper||2014-12-25|Abandonware, depends on imlib
x11-toolkits/fpc-gnome1||2014-12-25|Depends on imlib
graphics/fpc-imlib||2014-12-25|Depends on imlib
graphics/imlib||2014-12-25|Does not handle modern graphics libraries

View File

@ -73,7 +73,7 @@ _USE_GNOME_ALL= esound intlhack intltool introspection \
gnomeprefix
# GNOME 1 components
_USE_GNOME_ALL+= gdkpixbuf glib12 gtk12 imlib
_USE_GNOME_ALL+= gdkpixbuf glib12 gtk12
# GNOME 2 components
_USE_GNOME_ALL+= atk atspi cairo gal2 \
@ -204,13 +204,6 @@ gdkpixbuf_MAKE_ENV= GDK_PIXBUF_CONFIG="${GDK_PIXBUF_CONFIG}"
gdkpixbuf_DETECT= ${GDK_PIXBUF_CONFIG}
gdkpixbuf_USE_GNOME_IMPL=gtk12
IMLIB_CONFIG?= ${LOCALBASE}/bin/imlib-config
imlib_LIB_DEPENDS= libImlib.so:${PORTSDIR}/graphics/imlib
imlib_CONFIGURE_ENV= IMLIB_CONFIG="${IMLIB_CONFIG}"
imlib_MAKE_ENV= IMLIB_CONFIG="${IMLIB_CONFIG}"
imlib_DETECT= ${IMLIB_CONFIG}
imlib_USE_GNOME_IMPL= gtk12
gnomemimedata_DETECT= ${LOCALBASE}/libdata/pkgconfig/gnome-mime-data-2.0.pc
gnomemimedata_BUILD_DEPENDS=${gnomemimedata_DETECT}:${PORTSDIR}/misc/gnome-mime-data
gnomemimedata_RUN_DEPENDS=${gnomemimedata_DETECT}:${PORTSDIR}/misc/gnome-mime-data

View File

@ -356,7 +356,6 @@
SUBDIR += imc
SUBDIR += imgtops
SUBDIR += imgv
SUBDIR += imlib
SUBDIR += imlib2
SUBDIR += imlib2_loaders
SUBDIR += import-pictures

View File

@ -1,29 +0,0 @@
# Created by: Yukihiro Nakai <Nakai@Mlab.t.u-tokyo.ac.jp>
# $FreeBSD$
# $MCom: ports/graphics/imlib/Makefile,v 1.2 2006/09/10 00:51:11 mezz Exp $
PORTNAME= imlib
PORTVERSION= 1.9.15
PORTREVISION= 18
CATEGORIES= graphics
MASTER_SITES= GNOME
DIST_SUBDIR= gnome
MAINTAINER= gnome@FreeBSD.org
COMMENT= Graphic library for enlightenment package
LIB_DEPENDS= libpng.so:${PORTSDIR}/graphics/png \
libtiff.so:${PORTSDIR}/graphics/tiff \
libgif.so:${PORTSDIR}/graphics/giflib
USES= gmake libtool pathfix tar:bzip2
USE_XORG= sm xext x11
USE_GNOME= gtk12
GNU_CONFIGURE= yes
USE_LDCONFIG= yes
CONFIGURE_ARGS= --sysconfdir=${PREFIX}/etc/imlib --disable-modules
CPPFLAGS+= -I${LOCALBASE}/include
LIBS+= -L${LOCALBASE}/lib
INSTALL_TARGET= install-strip
.include <bsd.port.mk>

View File

@ -1,2 +0,0 @@
SHA256 (gnome/imlib-1.9.15.tar.bz2) = 4e6a270308a9ae16586bfc133c1a3dfb2e56f431edb66aaa3a80e36e5ed84ce0
SIZE (gnome/imlib-1.9.15.tar.bz2) = 683242

View File

@ -1,21 +0,0 @@
--- Imlib/load.c-orig 2012-06-16 20:19:27.000000000 +0200
+++ Imlib/load.c 2012-06-16 20:19:56.000000000 +0200
@@ -420,6 +420,18 @@
#endif /* HAVE_LIBTIFF */
#ifdef HAVE_LIBGIF
+
+static void
+PrintGifError(void)
+{
+ char *Err = GifErrorString();
+
+ if (Err != NULL)
+ fprintf(stderr, "\nGIF-LIB error: %s.\n", Err);
+ else
+ fprintf(stderr, "\nGIF-LIB undefined error %d.\n", GifError());
+}
+
unsigned char *
_LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t)
{

View File

@ -1,142 +0,0 @@
--- gdk_imlib/io-png.c
+++ gdk_imlib/io-png.c
@@ -40,13 +40,13 @@
return NULL;
}
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
}
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
@@ -275,13 +275,13 @@
return NULL;
}
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
}
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
@@ -301,6 +301,9 @@
/* Setup Translators */
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_expand(png_ptr);
+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+ png_set_expand(png_ptr);
+
png_set_strip_16(png_ptr);
png_set_packing(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
@@ -440,13 +443,13 @@
return NULL;
}
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
}
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
@@ -635,7 +638,7 @@
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
return 0;
}
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
fclose(f);
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
--- Imlib/load.c
+++ Imlib/load.c
@@ -197,12 +197,12 @@
png_destroy_read_struct(&png_ptr, NULL, NULL);
return NULL;
}
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
}
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
@@ -260,7 +260,8 @@
png_read_image(png_ptr, lines);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
ptr = data;
- if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ if (color_type == PNG_COLOR_TYPE_GRAY
+ || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{
for (y = 0; y < *h; y++)
{
@@ -285,6 +286,7 @@
}
}
}
+#if 0
else if (color_type == PNG_COLOR_TYPE_GRAY)
{
for (y = 0; y < *h; y++)
@@ -300,6 +302,7 @@
}
}
}
+#endif
else
{
for (y = 0; y < *h; y++)
--- Imlib/save.c
+++ Imlib/save.c
@@ -342,7 +342,7 @@
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
return 0;
}
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
fclose(f);
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
--- Imlib/utils.c
+++ Imlib/utils.c
@@ -1981,14 +1981,13 @@
png_destroy_read_struct(&png_ptr, NULL, NULL);
return NULL;
}
-
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;
}
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL;

View File

@ -1,44 +0,0 @@
Fix a bug in imlib so that kuickshow works.
https://bugs.kde.org/show_bug.cgi?id=248431
--- Imlib/misc.c
+++ Imlib/misc.c
@@ -423,6 +423,8 @@
if (xvir[i].depth > max)
max = xvir[i].depth;
}
+ if (max > 24)
+ max = 24;
if (max > 8)
{
id->x.depth = max;
@@ -1026,6 +1028,8 @@
if (xvir[i].depth > max)
max = xvir[i].depth;
}
+ if (max > 24)
+ max = 24;
if (max > 8)
{
id->x.depth = max;
--- gdk_imlib/misc.c
+++ gdk_imlib/misc.c
@@ -455,6 +455,8 @@
if (xvir[i].depth > max)
max = xvir[i].depth;
}
+ if (max > 24)
+ max = 24;
if (max > 8)
{
id->x.depth = max;
@@ -1004,6 +1006,8 @@
if (xvir[i].depth > max)
max = xvir[i].depth;
}
+ if (max > 24)
+ max = 24;
if (max > 8)
{
id->x.depth = max;

View File

@ -1,510 +0,0 @@
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/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/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
+++ 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
+++ 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
+++ 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
+++ 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
+++ 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
+++ 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)
{

View File

@ -1,4 +0,0 @@
Imlib is a general Image loading and rendering library designed to make the
task of loading images, and obtaining X-Windows drawables a simple task, as
well as a quick one. It also aims to provide simple manipulation routines that
might be desired for common operations.

View File

@ -1,41 +0,0 @@
bin/imlib-config
bin/imlib_config
etc/imlib/im_palette-small.pal
etc/imlib/im_palette-tiny.pal
etc/imlib/im_palette.pal
etc/imlib/imrc
include/Imlib.h
include/Imlib_private.h
include/Imlib_types.h
include/gdk_imlib.h
include/gdk_imlib_private.h
include/gdk_imlib_types.h
lib/libImlib.a
lib/libImlib.so
lib/libImlib.so.1
lib/libImlib.so.1.9.15
lib/libgdk_imlib.a
lib/libgdk_imlib.so
lib/libgdk_imlib.so.1
lib/libgdk_imlib.so.1.9.15
lib/libimlib-bmp.a
lib/libimlib-bmp.so
lib/libimlib-gif.a
lib/libimlib-gif.so
lib/libimlib-jpeg.a
lib/libimlib-jpeg.so
lib/libimlib-png.a
lib/libimlib-png.so
lib/libimlib-ppm.a
lib/libimlib-ppm.so
lib/libimlib-ps.a
lib/libimlib-ps.so
lib/libimlib-tiff.a
lib/libimlib-tiff.so
lib/libimlib-xpm.a
lib/libimlib-xpm.so
libdata/pkgconfig/imlib.pc
libdata/pkgconfig/imlibgdk.pc
share/aclocal/imlib.m4
man/man1/imlib-config.1.gz
man/man1/imlib_config.1.gz

View File

@ -12,6 +12,8 @@ DIST_SUBDIR= KDE/extragear
MAINTAINER= kde@FreeBSD.org
COMMENT= KDE image viewer
BROKEN= depends on imlib
USE_GNOME= imlib
USE_KDE4= kdelibs kdeprefix kdehier automoc4
USE_QT4= corelib opengl qmake_build moc_build rcc_build uic_build

View File

@ -16,6 +16,7 @@ PATCH_DIST_STRIP= -p1
MAINTAINER= mutoh@openedu.org
COMMENT= Network Type Trainer client program
BROKEN= depends on imlib
USE_GNOME= imlib
GNU_CONFIGURE= yes