imlib: contrib -> romster

This commit is contained in:
Danny Rawlins 2013-05-05 18:15:40 +10:00
parent 925c089930
commit 7ab21bae64
9 changed files with 0 additions and 857 deletions

View File

@ -1,61 +0,0 @@
drwxr-xr-x root/root usr/
drwxr-xr-x root/root usr/bin/
-rwxr-xr-x root/root usr/bin/imlib-config
-rwxr-xr-x root/root usr/bin/imlib_config
drwxr-xr-x root/root usr/etc/
-rw-r--r-- root/root usr/etc/im_palette-small.pal
-rw-r--r-- root/root usr/etc/im_palette-tiny.pal
-rw-r--r-- root/root usr/etc/im_palette.pal
-rw-r--r-- root/root usr/etc/imrc
drwxr-xr-x root/root usr/include/
-rw-r--r-- root/root usr/include/Imlib.h
-rw-r--r-- root/root usr/include/Imlib_private.h
-rw-r--r-- root/root usr/include/Imlib_types.h
-rw-r--r-- root/root usr/include/gdk_imlib.h
-rw-r--r-- root/root usr/include/gdk_imlib_private.h
-rw-r--r-- root/root usr/include/gdk_imlib_types.h
drwxr-xr-x root/root usr/lib/
-rw-r--r-- root/root usr/lib/libImlib.a
-rwxr-xr-x root/root usr/lib/libImlib.la
lrwxrwxrwx root/root usr/lib/libImlib.so -> libImlib.so.1.9.15
lrwxrwxrwx root/root usr/lib/libImlib.so.1 -> libImlib.so.1.9.15
-rwxr-xr-x root/root usr/lib/libImlib.so.1.9.15
-rw-r--r-- root/root usr/lib/libgdk_imlib.a
-rwxr-xr-x root/root usr/lib/libgdk_imlib.la
lrwxrwxrwx root/root usr/lib/libgdk_imlib.so -> libgdk_imlib.so.1.9.15
lrwxrwxrwx root/root usr/lib/libgdk_imlib.so.1 -> libgdk_imlib.so.1.9.15
-rwxr-xr-x root/root usr/lib/libgdk_imlib.so.1.9.15
-rw-r--r-- root/root usr/lib/libimlib-bmp.a
-rwxr-xr-x root/root usr/lib/libimlib-bmp.la
-rwxr-xr-x root/root usr/lib/libimlib-bmp.so
-rw-r--r-- root/root usr/lib/libimlib-gif.a
-rwxr-xr-x root/root usr/lib/libimlib-gif.la
-rwxr-xr-x root/root usr/lib/libimlib-gif.so
-rw-r--r-- root/root usr/lib/libimlib-jpeg.a
-rwxr-xr-x root/root usr/lib/libimlib-jpeg.la
-rwxr-xr-x root/root usr/lib/libimlib-jpeg.so
-rw-r--r-- root/root usr/lib/libimlib-png.a
-rwxr-xr-x root/root usr/lib/libimlib-png.la
-rwxr-xr-x root/root usr/lib/libimlib-png.so
-rw-r--r-- root/root usr/lib/libimlib-ppm.a
-rwxr-xr-x root/root usr/lib/libimlib-ppm.la
-rwxr-xr-x root/root usr/lib/libimlib-ppm.so
-rw-r--r-- root/root usr/lib/libimlib-ps.a
-rwxr-xr-x root/root usr/lib/libimlib-ps.la
-rwxr-xr-x root/root usr/lib/libimlib-ps.so
-rw-r--r-- root/root usr/lib/libimlib-tiff.a
-rwxr-xr-x root/root usr/lib/libimlib-tiff.la
-rwxr-xr-x root/root usr/lib/libimlib-tiff.so
-rw-r--r-- root/root usr/lib/libimlib-xpm.a
-rwxr-xr-x root/root usr/lib/libimlib-xpm.la
-rwxr-xr-x root/root usr/lib/libimlib-xpm.so
drwxr-xr-x root/root usr/lib/pkgconfig/
-rw-r--r-- root/root usr/lib/pkgconfig/imlib.pc
-rw-r--r-- root/root usr/lib/pkgconfig/imlibgdk.pc
drwxr-xr-x root/root usr/man/
drwxr-xr-x root/root usr/man/man1/
-rw-r--r-- root/root usr/man/man1/imlib-config.1.gz
-rw-r--r-- root/root usr/man/man1/imlib_config.1.gz
drwxr-xr-x root/root usr/share/
drwxr-xr-x root/root usr/share/aclocal/
-rw-r--r-- root/root usr/share/aclocal/imlib.m4

View File

@ -1,7 +0,0 @@
e2bad3670e0e3175c140befe992c578f gtk-1-for-imlib.m4.bz2
be3a409ee49e0e7bd4d8dc3cb0d151e4 imlib-1.9.15-asneeded.patch
7b62bbedef5db2774812923bd55f17f9 imlib-1.9.15-bpp16-CVE-2007-3568.patch
89b692ce386215e37cfca86788fd2ea1 imlib-1.9.15-configure.patch
5212233a3d01640fbf4feb57a6918e6e imlib-1.9.15-fix-rendering.patch
53b35c928f5d0d1f002595735c6b9b14 imlib-1.9.15-security.patch
7db987e6c52e4daf70d7d0f471238eae imlib-1.9.15.tar.bz2

View File

@ -1,38 +0,0 @@
# Description: An image loading and rendering library.
# URL: http://ftp.acc.umu.se/pub/GNOME/sources/imlib/1.9/
# Maintainer: Danny Rawlins, monster dot romster at gmail dot com
# Packager: Daniel Mueller, daniel at danm dot de
# Depends on: gtk1 libungif libtiff libpng
name=imlib
version=1.9.15
release=2
source=(http://ftp.gnome.org/pub/GNOME/sources/imlib/${version%.*}/imlib-$version.tar.bz2
imlib-1.9.15-configure.patch
imlib-1.9.15-security.patch
imlib-1.9.15-bpp16-CVE-2007-3568.patch
imlib-1.9.15-fix-rendering.patch
imlib-1.9.15-asneeded.patch
gtk-1-for-imlib.m4.bz2)
build() {
cd imlib-$version
patch -p 1 -i $SRC/imlib-1.9.15-configure.patch
patch -p 1 -i $SRC/imlib-1.9.15-security.patch
patch -p 1 -i $SRC/imlib-1.9.15-bpp16-CVE-2007-3568.patch
patch -p 1 -i $SRC/imlib-1.9.15-fix-rendering.patch
patch -p 1 -i $SRC/imlib-1.9.15-asneeded.patch
mkdir m4
bzcat $SRC/gtk-1-for-imlib.m4.bz2 > m4/gtk-1-for-imlib.m4
autoreconf -i
./configure \
--prefix=/usr \
--mandir=/usr/man
make
make DESTDIR=$PKG install
}

Binary file not shown.

View File

@ -1,38 +0,0 @@
This code is broken with the newer libtool. Just dropping it is more or less
safe as in any case if libtool does not supports shared libraries it'll issue
an error...
Adding include is necessary for gcc-4.3.
--- imlib-1.9.15.orig/configure.in 2008-07-16 09:18:35 +0000
+++ imlib-1.9.15/configure.in 2008-07-16 09:18:43 +0000
@@ -61,6 +61,7 @@
AC_TRY_RUN([
#include <glib.h>
#include <gmodule.h>
+#include <stdlib.h>
main ()
{
if (g_module_supported ())
@@ -74,21 +74,6 @@
CFLAGS="$oCFLAGS"
fi
-dnl Now we check to see if our libtool supports shared lib deps
-dnl (in a rather ugly way even)
-builddir=`pwd`
-if $dynworks; then
- imlib_libtool_config="$builddir/libtool --config"
- imlib_deplibs_check=`$imlib_libtool_config | \
- grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
- sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
- if test "x$imlib_deplibs_check" = "xnone" || \
- test "x$imlib_deplibs_check" = "xunknown" || \
- test "x$imlib_deplibs_check" = "x"; then
- dynworks=false
- fi
-fi
-
if $dynworks; then
AC_DEFINE(USE_GMODULE, 1, [ ])
GMODULE_LIBS="`glib-config --libs gmodule`"

View File

@ -1,11 +0,0 @@
--- imlib-1.9.15.orig/Imlib/load.c 2007-08-13 23:06:20.000000000 -0300
+++ imlib-1.9.15/Imlib/load.c 2007-08-13 23:06:51.000000000 -0300
@@ -645,7 +645,7 @@
planes = (int)word;
fread(&word, 2, 1, file);
bpp = (int)word;
- if (bpp != 1 && bpp != 4 && bpp != 8 && bpp && 16 && bpp != 24 && bpp != 32)
+ if (bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32)
{
fprintf(stderr, "IMLIB ERROR: unknown bitdepth in file\n");
return NULL;

View File

@ -1,87 +0,0 @@
diff -pruN imlib-1.9.15.orig/configure.in imlib-1.9.15/configure.in
--- imlib-1.9.15.orig/configure.in 2008-10-23 21:34:03.904349217 +1100
+++ imlib-1.9.15/configure.in 2008-10-23 21:35:56.881224111 +1100
@@ -5,6 +5,7 @@ AC_INIT(gdk_imlib/gdk_imlib.h)
cflags_set=${CFLAGS+set}
AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(imlib, 1.9.15)
AC_PROG_CC
@@ -17,11 +18,26 @@ dnl Give the user an option to compile w
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")
+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)
+
AM_PATH_GTK(1.2.1,[
GDK_IMLIB="gdk_imlib utils"],[
GDK_IMLIB=""
AC_MSG_WARN([*** gdk_imlib will not be built ***])])
+else
+ AC_MSG_RESULT(yes)
+ GDK_IMLIB=""
+fi
+
AC_MSG_CHECKING(whether to build gmodulized imlib)
AC_ARG_ENABLE(modules, [ --disable-modules Disables dynamic module loading],[
diff -pruN imlib-1.9.15.orig/imlib-config.in imlib-1.9.15/imlib-config.in
--- imlib-1.9.15.orig/imlib-config.in 2008-10-23 21:34:03.904349217 +1100
+++ imlib-1.9.15/imlib-config.in 2008-10-23 21:34:28.226349920 +1100
@@ -46,15 +46,9 @@ while test $# -gt 0; do
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 -pruN imlib-1.9.15.orig/imlib.m4 imlib-1.9.15/imlib.m4
--- imlib-1.9.15.orig/imlib.m4 2008-10-23 21:34:03.901349273 +1100
+++ imlib-1.9.15/imlib.m4 2008-10-23 21:34:28.227349890 +1100
@@ -6,7 +6,7 @@
dnl AM_PATH_IMLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for IMLIB, and define IMLIB_CFLAGS and IMLIB_LIBS
dnl
-AC_DEFUN(AM_PATH_IMLIB,
+AC_DEFUN([AM_PATH_IMLIB],
[dnl
dnl Get the cflags and libraries from the imlib-config script
dnl
@@ -164,7 +164,7 @@ int main ()
])
# Check for gdk-imlib
-AC_DEFUN(AM_PATH_GDK_IMLIB,
+AC_DEFUN([AM_PATH_GDK_IMLIB],
[dnl
dnl Get the cflags and libraries from the imlib-config script
dnl
diff -pruN imlib-1.9.15.orig/Makefile.am imlib-1.9.15/Makefile.am
--- imlib-1.9.15.orig/Makefile.am 2008-10-23 21:34:03.901349273 +1100
+++ imlib-1.9.15/Makefile.am 2008-10-23 21:38:28.168099386 +1100
@@ -1,3 +1,5 @@
+ACLOCAL_AMFLAGS= -I m4
+
SUBDIRS = @GDK_IMLIB@ Imlib config doc
bin_SCRIPTS = imlib-config

View File

@ -1,105 +0,0 @@
Michel Dänzer <daenzer AT debian.org>
* The boolean value returned via the last parameter to XShmQueryVersion()
isn't honoured everywhere.
* The init functions that take parameters allow the caller to enable shared
pixmaps when they aren't supported (or disabled by configuration files).
These result in incorrect rendering when the MIT-SHM extension doesn't support
shared pixmaps, e.g. using EXA with current versions of Xorg.
http://bugs.gentoo.org/show_bug.cgi?id=197489
diff -up -ru imlib-1.9.15.orig/gdk_imlib/misc.c imlib-1.9.15/gdk_imlib/misc.c
--- imlib-1.9.15.orig/gdk_imlib/misc.c 2002-03-04 18:06:32.000000000 +0100
+++ imlib-1.9.15/gdk_imlib/misc.c 2007-10-28 14:00:04.000000000 +0100
@@ -674,6 +674,10 @@ gdk_imlib_init_params(GdkImlibInitParams
visual = gdk_rgb_get_visual();
id->x.visual = GDK_VISUAL_XVISUAL(visual); /* the visual type */
id->x.depth = visual->depth; /* the depth of the screen in bpp */
+
+ id->x.shm = 0;
+ id->x.shmp = 0;
+ id->max_shm = 0;
#ifdef HAVE_SHM
if (XShmQueryExtension(id->x.disp))
{
@@ -689,17 +693,14 @@ gdk_imlib_init_params(GdkImlibInitParams
id->x.last_xim = NULL;
id->x.last_sxim = NULL;
id->max_shm = 0x7fffffff;
- if (XShmPixmapFormat(id->x.disp) == ZPixmap)
+ if ((XShmPixmapFormat(id->x.disp) == ZPixmap) &&
+ (pm == True))
id->x.shmp = 1;
}
}
}
- else
#endif
- {
- id->x.shm = 0;
- id->x.shmp = 0;
- }
+
id->cache.on_image = 0;
id->cache.size_image = 0;
id->cache.num_image = 0;
@@ -935,8 +936,8 @@ gdk_imlib_init_params(GdkImlibInitParams
}
if (p->flags & PARAMS_SHAREDPIXMAPS)
{
- if (id->x.shm)
- id->x.shmp = p->sharedpixmaps;
+ if (!p->sharedpixmaps)
+ id->x.shmp = 0;
}
if (p->flags & PARAMS_PALETTEOVERRIDE)
override = p->paletteoverride;
diff -up -ru imlib-1.9.15.orig/Imlib/misc.c imlib-1.9.15/Imlib/misc.c
--- imlib-1.9.15.orig/Imlib/misc.c 2004-09-21 02:22:59.000000000 +0200
+++ imlib-1.9.15/Imlib/misc.c 2007-10-28 14:00:23.000000000 +0100
@@ -675,6 +675,10 @@ Imlib_init_with_params(Display * disp, I
id->x.root = DefaultRootWindow(disp); /* the root window id */
id->x.visual = DefaultVisual(disp, id->x.screen); /* the visual type */
id->x.depth = DefaultDepth(disp, id->x.screen); /* the depth of the screen in bpp */
+
+ id->x.shm = 0;
+ id->x.shmp = 0;
+ id->max_shm = 0;
#ifdef HAVE_SHM
if (XShmQueryExtension(id->x.disp))
{
@@ -690,17 +694,14 @@ Imlib_init_with_params(Display * disp, I
id->x.last_xim = NULL;
id->x.last_sxim = NULL;
id->max_shm = 0x7fffffff;
- if (XShmPixmapFormat(id->x.disp) == ZPixmap)
+ if ((XShmPixmapFormat(id->x.disp) == ZPixmap &&
+ (pm == True)))
id->x.shmp = 1;
}
}
}
- else
#endif
- {
- id->x.shm = 0;
- id->x.shmp = 0;
- }
+
id->cache.on_image = 0;
id->cache.size_image = 0;
id->cache.num_image = 0;
@@ -952,8 +953,8 @@ Imlib_init_with_params(Display * disp, I
}
if (p->flags & PARAMS_SHAREDPIXMAPS)
{
- if (id->x.shm)
- id->x.shmp = p->sharedpixmaps;
+ if (!p->sharedpixmaps)
+ id->x.shmp = 0;
}
if (p->flags & PARAMS_PALETTEOVERRIDE)
override = p->paletteoverride;

View File

@ -1,510 +0,0 @@
diff -Nru imlib-1.9.15.orig/Imlib/load.c imlib-1.9.15/Imlib/load.c
--- imlib-1.9.15.orig/Imlib/load.c 2004-12-23 23:50:22.820521823 +0100
+++ imlib-1.9.15/Imlib/load.c 2004-12-23 23:50:36.549790030 +0100
@@ -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;
}
@@ -1000,7 +1008,12 @@
comment = 0;
quote = 0;
context = 0;
+ memset(lookup, 0, sizeof(lookup));
+
line = malloc(lsz);
+ if (!line)
+ return NULL;
+
while (!done)
{
pc = c;
@@ -1029,25 +1042,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);
@@ -1080,11 +1093,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);
@@ -1107,10 +1122,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])
{
@@ -1140,14 +1155,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;
}
}
}
@@ -1376,12 +1394,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 -Nru imlib-1.9.15.orig/Imlib/utils.c imlib-1.9.15/Imlib/utils.c
--- imlib-1.9.15.orig/Imlib/utils.c 2004-12-23 23:50:22.824519281 +0100
+++ imlib-1.9.15/Imlib/utils.c 2004-12-23 23:50:36.553787487 +0100
@@ -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 -Nru imlib-1.9.15.orig/gdk_imlib/io-gif.c imlib-1.9.15/gdk_imlib/io-gif.c
--- imlib-1.9.15.orig/gdk_imlib/io-gif.c 2004-12-23 23:50:22.863494493 +0100
+++ imlib-1.9.15/gdk_imlib/io-gif.c 2004-12-23 23:50:36.554786852 +0100
@@ -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 -Nru imlib-1.9.15.orig/gdk_imlib/io-ppm.c imlib-1.9.15/gdk_imlib/io-ppm.c
--- imlib-1.9.15.orig/gdk_imlib/io-ppm.c 2004-12-23 23:50:22.864493857 +0100
+++ imlib-1.9.15/gdk_imlib/io-ppm.c 2004-12-23 23:50:36.556785581 +0100
@@ -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 -Nru imlib-1.9.15.orig/gdk_imlib/io-tiff.c imlib-1.9.15/gdk_imlib/io-tiff.c
--- imlib-1.9.15.orig/gdk_imlib/io-tiff.c 2004-12-23 23:50:22.864493857 +0100
+++ imlib-1.9.15/gdk_imlib/io-tiff.c 2004-12-23 23:50:36.557784945 +0100
@@ -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 -Nru imlib-1.9.15.orig/gdk_imlib/io-xpm.c imlib-1.9.15/gdk_imlib/io-xpm.c
--- imlib-1.9.15.orig/gdk_imlib/io-xpm.c 2004-12-23 23:50:22.864493857 +0100
+++ imlib-1.9.15/gdk_imlib/io-xpm.c 2004-12-23 23:50:36.558784309 +0100
@@ -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 -Nru imlib-1.9.15.orig/gdk_imlib/misc.c imlib-1.9.15/gdk_imlib/misc.c
--- imlib-1.9.15.orig/gdk_imlib/misc.c 2004-12-23 23:50:22.866492586 +0100
+++ imlib-1.9.15/gdk_imlib/misc.c 2004-12-23 23:50:36.560783038 +0100
@@ -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 -Nru imlib-1.9.15.orig/gdk_imlib/utils.c imlib-1.9.15/gdk_imlib/utils.c
--- imlib-1.9.15.orig/gdk_imlib/utils.c 2004-12-23 23:50:22.869490679 +0100
+++ imlib-1.9.15/gdk_imlib/utils.c 2004-12-23 23:50:36.563781131 +0100
@@ -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)
{