You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

539 lines
14 KiB

#!/bin/sh
# Copyright 2015-2017 tde-slackbuilds project on GitHub
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for
# any purpose with or without fee is hereby granted, provided that
# the above copyright notice and this permission notice appear in all
# copies.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
PRGNAM=imlib
VERSION=1.9.15
BUILD=${BUILD:-1}
TAG=${TAG:-}
ARCHIVE_TYPE="tar.bz2"
SRCURL="https://download.gnome.org/sources/$PRGNAM/1.9/$PRGNAM-$VERSION.$ARCHIVE_TYPE"
source ../../get-source.sh
getsource_fn
untar_fn
## patches thanks to fedora
echo $'--- Imlib/load.c
+++ Imlib/load.c
@@ -6,0 +7,2 @@
+#define G_MAXINT ((int) 0x7fffffff)
+
@@ -43,0 +46,2 @@
+ * we check G_MAXINT/4 because rend.c malloc\'s w * h * bpp
+ * + 3 is safety margin
@@ -48,3 +52,5 @@
- 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);
@@ -194 +200 @@
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
@@ -199 +205 @@
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
@@ -257 +263,2 @@
- if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ if (color_type == PNG_COLOR_TYPE_GRAY
+ || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
@@ -281,0 +289 @@
+#if 0
@@ -296,0 +305 @@
+#endif
@@ -363 +372,3 @@
- if(ww > 32767 || hh > 32767)
+ if (ww <= 0 || ww > 32767 ||
+ hh <= 0 || hh > 32767 ||
+ hh >= (G_MAXINT/sizeof(uint32)) / ww)
@@ -445,0 +457,3 @@
+#ifdef GIFLIB_MAJOR
+ gif = DGifOpenFileHandle(fd, NULL);
+#else
@@ -446,0 +461 @@
+#endif
@@ -453,0 +469,3 @@
+#ifdef GIFLIB_MAJOR
+\t fprintf(stderr, "giflib error: %s\\n", GifErrorString(gif->Error));
+#else
@@ -454,0 +473 @@
+#endif
@@ -460,0 +480,3 @@
+#ifdef GIFLIB_MAJOR
+\t fprintf(stderr, "giflib error: %s\\n", GifErrorString(gif->Error));
+#else
@@ -461,0 +484 @@
+#endif
@@ -466 +489 @@
-\t if (*h > 32767 || *w > 32767)
+\t if (*h <= 0 || *h > 32767 || *w <= 0 || *w > 32767)
@@ -472,0 +496,3 @@
+#ifdef GIFLIB_MAJOR
+\t DGifCloseFile(gif, NULL);
+#else
@@ -473,0 +500 @@
+#endif
@@ -478,0 +506,3 @@
+#ifdef GIFLIB_MAJOR
+\t DGifCloseFile(gif, NULL);
+#else
@@ -479,0 +510 @@
+#endif
@@ -489,0 +521,3 @@
+#ifdef GIFLIB_MAJOR
+\t\t DGifCloseFile(gif, NULL);
+#else
@@ -490,0 +525 @@
+#endif
@@ -578,0 +614,3 @@
+#ifdef GIFLIB_MAJOR
+ DGifCloseFile(gif, NULL);
+#else
@@ -579,0 +618 @@
+#endif
@@ -648 +687 @@
- 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)
@@ -1002,0 +1042,2 @@
+ memset(lookup, 0, sizeof(lookup));
+
@@ -1003,0 +1045,3 @@
+ if (!line)
+ return NULL;
+
@@ -1032 +1076 @@
- if (ncolors > 32766)
+ if (ncolors <= 0 || ncolors > 32766)
@@ -1038 +1082 @@
-\t\t if (cpp > 5)
+\t\t if (cpp <= 0 || cpp > 5)
@@ -1044 +1088 @@
-\t\t if (*w > 32767)
+\t\t if (*w <= 0 || *w > 32767)
@@ -1050 +1094 @@
-\t\t if (*h > 32767)
+\t\t if (*h <= 0 || *h > 32767)
@@ -1082,0 +1127 @@
+\t\t int space;
@@ -1087,0 +1133 @@
+\t\t space = sizeof(col) - 1;
@@ -1110,4 +1156,4 @@
-\t\t\t\t if (col[0])
-\t\t\t\t\tstrcat(col, " ");
- if (strlen(col) + strlen(s) < sizeof(col))
-\t\t\t\t\tstrcat(col, s);
+\t\t\t\t if (col[0] && space > 0)
+\t\t\t\t\tstrcat(col, " "), space -= 1;
+ if (slen <= space)
+\t\t\t\t\tstrcat(col, s), space -= slen;
@@ -1143 +1189,2 @@
-\t\t\t\t strcpy(tok, s);
+\t\t\t\t if (slen < sizeof(tok));
+\t\t\t\t strcpy(tok, s);
@@ -1144,0 +1192 @@
+\t\t\t\t space = sizeof(col) - 1;
@@ -1148,3 +1196,4 @@
-\t\t\t\t if (col[0])
-\t\t\t\t strcat(col, " ");
-\t\t\t\t strcat(col, s);
+\t\t\t\t if (col[0] && space > 0)
+\t\t\t\t strcat(col, " "), space -=1;
+\t\t\t\t if (slen <= space)
+\t\t\t\t strcat(col, s), space -= slen;
@@ -1379 +1428 @@
-\t if (a > 32767)
+\t if (a <= 0 || a > 32767)
@@ -1384 +1433 @@
-\t if (b > 32767)
+\t if (b <= 0 || b > 32767)
--- Imlib/misc.c
+++ Imlib/misc.c
@@ -677,0 +678,4 @@
+
+ id->x.shm = 0;
+ id->x.shmp = 0;
+ id->max_shm = 0;
@@ -693 +697,2 @@
-\t if (XShmPixmapFormat(id->x.disp) == ZPixmap)
+\t if ((XShmPixmapFormat(id->x.disp) == ZPixmap &&
+\t\t (pm == True)))
@@ -698 +702,0 @@
- else
@@ -700,4 +704 @@
- {
- id->x.shm = 0;
- id->x.shmp = 0;
- }
+
@@ -955,2 +956,2 @@
-\t if (id->x.shm)
-\t id->x.shmp = p->sharedpixmaps;
+\t if (!p->sharedpixmaps)
+\t id->x.shmp = 0;
--- Imlib/save.c
+++ Imlib/save.c
@@ -345 +345 @@
-\t if (setjmp(png_ptr->jmpbuf))
+\t if (setjmp(png_jmpbuf(png_ptr)))
--- Imlib/utils.c
+++ Imlib/utils.c
@@ -1498,0 +1499 @@
+ memset(lookup, 0, sizeof(lookup));
@@ -1502,0 +1504,15 @@
+ if (!line)
+\tbreak;
+ line = strdup(line);
+ if (!line)
+\tbreak;
+ len = strlen(line);
+ for (i = 0; i < len; ++i)
+\t{
+\t c = line[i];
+\t if (c < 32)
+\t line[i] = 32;
+\t else if (c > 127)
+\t line[i] = 127;
+\t}
+
@@ -1507 +1523 @@
-\t if (ncolors > 32766)
+\t if (ncolors <= 0 || ncolors > 32766)
@@ -1510,0 +1527 @@
+\t free(line);
@@ -1513 +1530 @@
-\t if (cpp > 5)
+\t if (cpp <= 0 || cpp > 5)
@@ -1516,0 +1534 @@
+\t free(line);
@@ -1519 +1537 @@
-\t if (w > 32767)
+\t if (w <= 0 || w > 32767)
@@ -1522,0 +1541 @@
+\t free(line);
@@ -1525 +1544 @@
-\t if (h > 32767)
+\t if (h <= 0 || h > 32767)
@@ -1528,0 +1548 @@
+\t free(line);
@@ -1535,0 +1556 @@
+\t free(line);
@@ -1544,0 +1566 @@
+\t free(line);
@@ -1819,0 +1842 @@
+ free(line);
@@ -1961,2 +1984 @@
-
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
@@ -1968 +1990 @@
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
--- configure
+++ configure
@@ -22914,2 +22913,0 @@
-CPPFLAGS="$CPPFLAGS -I$includedir -I$prefix/include"
-
--- configure.in
+++ configure.in
@@ -144,2 +143,0 @@
-CPPFLAGS="$CPPFLAGS -I$includedir -I$prefix/include"
-
--- gdk_imlib/io-gif.c
+++ gdk_imlib/io-gif.c
@@ -32,0 +33,3 @@
+#ifdef GIFLIB_MAJOR
+ gif = DGifOpenFileHandle(fd, NULL);
+#else
@@ -33,0 +37 @@
+#endif
@@ -45,0 +50,3 @@
+#ifdef GIFLIB_MAJOR
+\t fprintf(stderr, "giflib error: %s\\n", GifErrorString(gif->Error));
+#else
@@ -46,0 +54 @@
+#endif
@@ -52,0 +61,3 @@
+#ifdef GIFLIB_MAJOR
+\t fprintf(stderr, "giflib error: %s\\n", GifErrorString(gif->Error));
+#else
@@ -53,0 +65 @@
+#endif
@@ -58 +70 @@
-\t if(*h > 32767 || *w > 32767)
+\t if(*h <= 0 || *h > 32767 || *w <= 0 || *w > 32767)
@@ -64,0 +77,3 @@
+#ifdef GIFLIB_MAJOR
+\t DGifCloseFile(gif, NULL);
+#else
@@ -65,0 +81 @@
+#endif
@@ -70,0 +87,3 @@
+#ifdef GIFLIB_MAJOR
+\t DGifCloseFile(gif, NULL);
+#else
@@ -71,0 +91 @@
+#endif
@@ -81,0 +102,3 @@
+#ifdef GIFLIB_MAJOR
+\t\t DGifCloseFile(gif, NULL);
+#else
@@ -82,0 +106 @@
+#endif
@@ -170,0 +195,3 @@
+#ifdef GIFLIB_MAJOR
+ DGifCloseFile(gif, NULL);
+#else
@@ -171,0 +199 @@
+#endif
--- gdk_imlib/io-png.c
+++ gdk_imlib/io-png.c
@@ -43 +43 @@
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
@@ -49 +49 @@
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
@@ -278 +278 @@
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
@@ -284 +284 @@
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
@@ -303,0 +304,3 @@
+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+ png_set_expand(png_ptr);
+
@@ -443 +446 @@
-\tif (setjmp(png_ptr->jmpbuf))
+\tif (setjmp(png_jmpbuf(png_ptr)))
@@ -449 +452 @@
-\tif (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+\tif (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
@@ -638 +641 @@
-\t if (setjmp(png_ptr->jmpbuf))
+\t if (setjmp(png_jmpbuf(png_ptr)))
--- gdk_imlib/io-ppm.c
+++ gdk_imlib/io-ppm.c
@@ -56 +56 @@
-\t if (a > 32767)
+\t if (a <= 0 || a > 32767)
@@ -61 +61 @@
-\t if (b > 32767)
+\t if (b <= 0 || b > 32767)
--- gdk_imlib/io-tiff.c
+++ gdk_imlib/io-tiff.c
@@ -39 +39,3 @@
- if(ww > 32767 || hh > 32767)
+ if (ww <= 0 || ww > 32767 ||
+ hh <= 0 || hh > 32767 ||
+ hh >= (G_MAXINT/sizeof(uint32)) / ww)
--- gdk_imlib/io-xpm.c
+++ gdk_imlib/io-xpm.c
@@ -42,0 +43 @@
+ memset(lookup, 0, sizeof(lookup));
@@ -44,0 +46,3 @@
+ if (!line)
+ return NULL;
+
@@ -73 +77 @@
-\t\t if (ncolors > 32766)
+\t\t if (ncolors <= 0 || ncolors > 32766)
@@ -79 +83 @@
-\t\t if (cpp > 5)
+\t\t if (cpp <= 0 || cpp > 5)
@@ -85 +89 @@
-\t\t if (*w > 32767)
+\t\t if (*w <= 0 || *w > 32767)
@@ -91 +95 @@
-\t\t if (*h > 32767)
+\t\t if (*h <= 0 || *h > 32767)
@@ -122,0 +127 @@
+\t\t int space;
@@ -127,0 +133 @@
+\t\t space = sizeof(col) - 1;
@@ -150,4 +156,4 @@
-\t\t\t\t if (col[0])
-\t\t\t\t\tstrcat(col, " ");
-\t\t\t\t if (strlen(col) + strlen(s) < sizeof(col))
-\t\t\t\t\tstrcat(col, s);
+\t\t\t\t if (col[0] && space > 0)
+\t\t\t\t\tstrncat(col, " ", space), space -= 1;
+\t\t\t\t if (slen <= space)
+\t\t\t\t\tstrcat(col, s), space -= slen;
@@ -183 +189,2 @@
-\t\t\t\t strcpy(tok, s);
+\t\t\t\t if (slen < sizeof(tok))
+\t\t\t\t strcpy(tok, s);
@@ -184,0 +192 @@
+\t\t\t\t space = sizeof(col) - 1;
@@ -188,3 +196,4 @@
-\t\t\t\t if (col[0])
-\t\t\t\t strcat(col, " ");
-\t\t\t\t strcat(col, s);
+\t\t\t\t if (col[0] && space > 0)
+\t\t\t\t strcat(col, " "), space -= 1;
+\t\t\t\t if (slen <= space)
+\t\t\t\t strcat(col, s), space -= slen;
--- gdk_imlib/misc.c
+++ gdk_imlib/misc.c
@@ -676,0 +677,4 @@
+
+ id->x.shm = 0;
+ id->x.shmp = 0;
+ id->max_shm = 0;
@@ -692 +696,2 @@
-\t if (XShmPixmapFormat(id->x.disp) == ZPixmap)
+\t if ((XShmPixmapFormat(id->x.disp) == ZPixmap) &&
+\t\t (pm == True))
@@ -697 +701,0 @@
- else
@@ -699,4 +703 @@
- {
- id->x.shm = 0;
- id->x.shmp = 0;
- }
+
@@ -938,2 +939,2 @@
-\t if (id->x.shm)
-\t id->x.shmp = p->sharedpixmaps;
+\t if (!p->sharedpixmaps)
+\t id->x.shmp = 0;
@@ -1357,0 +1359,2 @@
+ *\twe check G_MAX_INT/4 because rend.c malloc\'s w * h * bpp
+ *\t+ 3 is safety margin
@@ -1362 +1365,3 @@
-\tif( w > 32767 || h > 32767)
+\tif (w <= 0 || w > 32767 ||
+\t h <= 0 || h > 32767 ||
+\t h >= (G_MAXINT/4 - 1) / w)
@@ -1364 +1369 @@
-\treturn malloc(w * h * 3);
+\treturn malloc(w * h * 3 + 3);
@@ -1365,0 +1371 @@
+
--- gdk_imlib/utils.c
+++ gdk_imlib/utils.c
@@ -1238,0 +1239 @@
+ memset(lookup, 0, sizeof(lookup));
@@ -1242,0 +1244,15 @@
+ if (!line)
+\tbreak;
+ line = strdup(line);
+ if (!line)
+\tbreak;
+ len = strlen(line);
+ for (i = 0; i < len; ++i)
+ {
+\t c = line[i];
+\t if (c < 32)
+\t line[i] = 32;
+\t else if (c > 127)
+\t line[i] = 127;
+\t}
+
@@ -1247 +1263 @@
-\t if (ncolors > 32766)
+\t if (ncolors <= 0 || ncolors > 32766)
@@ -1250,0 +1267 @@
+\t free(line);
@@ -1253 +1270 @@
-\t if (cpp > 5)
+\t if (cpp <= 0 || cpp > 5)
@@ -1256,0 +1274 @@
+\t free(line);
@@ -1259 +1277 @@
-\t if (w > 32767)
+\t if (w <= 0 || w > 32767)
@@ -1262,0 +1281 @@
+\t free(line);
@@ -1265 +1284 @@
-\t if (h > 32767)
+\t if (h <= 0 || h > 32767)
@@ -1268,0 +1288 @@
+\t free(line);
@@ -1275,0 +1296 @@
+\t free(line);
@@ -1284,0 +1306 @@
+\t free(line);
@@ -1358 +1380 @@
-\t\t\t if (colptr + ls <= sizeof(col))
+\t\t\t if (colptr + ls < sizeof(col))
@@ -1560,0 +1583 @@
+ free(line);
' | while read line
do
patch -p0
done
listdocs_fn
chown_fn
cd_builddir_fn
CFLAGS="$SLKCFLAGS" \
CC=$COMPILER \
../configure \
--prefix=/usr \
--libdir=/usr/lib$LIBDIRSUFFIX \
--disable-static
make_fn
installdocs_fn
INSTALL_TDE=/usr
mangzip_fn
strip_fn
mkdir_install_fn
echo "
# HOW TO EDIT THIS FILE:
# The 'handy ruler' below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: Imlib (image loading and rendering library)
$PRGNAM:
$PRGNAM: Imlib is a display depth-independent image loading and rendering
$PRGNAM: library. Imlib is designed to simplify and speed up the process of
$PRGNAM: loading images and obtaining X Window System drawables. Imlib
$PRGNAM: provides many simple manipulation routines which can be used for
$PRGNAM: common operations.
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
" > $PKG/install/slack-desc
makepkg_fn