From 0413d03e39e08104849fe5bb43f3d3ba89fe3750 Mon Sep 17 00:00:00 2001 From: Esteban Carnevale Date: Sun, 17 May 2015 20:18:56 -0300 Subject: gdk-pixbuf: add new package --- pcr/gdk-pixbuf/PKGBUILD | 51 ++++++++ .../gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch | 48 ++++++++ pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_secure.patch | 19 +++ pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-loaders.patch | 134 +++++++++++++++++++++ pcr/gdk-pixbuf/gdk-pixbuf-0.22.0.patch | 129 ++++++++++++++++++++ pcr/gdk-pixbuf/libpng15.patch | 30 +++++ 6 files changed, 411 insertions(+) create mode 100644 pcr/gdk-pixbuf/PKGBUILD create mode 100644 pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch create mode 100644 pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_secure.patch create mode 100644 pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-loaders.patch create mode 100644 pcr/gdk-pixbuf/gdk-pixbuf-0.22.0.patch create mode 100644 pcr/gdk-pixbuf/libpng15.patch diff --git a/pcr/gdk-pixbuf/PKGBUILD b/pcr/gdk-pixbuf/PKGBUILD new file mode 100644 index 000000000..e569b2902 --- /dev/null +++ b/pcr/gdk-pixbuf/PKGBUILD @@ -0,0 +1,51 @@ +# $Id: PKGBUILD 99752 2013-10-30 23:29:49Z allan $ +# Maintainer: Brian Bidulock +# Contributor: Sergej Pupykin +# Contributor: dorphell +# Contributor: Judd Vinet + +pkgname=gdk-pixbuf +pkgver=0.22.0 +pkgrel=12 +pkgdesc="Image loading and manipulation library" +arch=('i686' 'x86_64') +url="http://www.gtk.org/" +license=('GPL' 'LGPL') +depends=('gtk' 'libtiff' 'libpng') +makedepends=('libxt') +source=(ftp://ftp.gnome.org/pub/gnome/sources/${pkgname}/0.22/${pkgname}-${pkgver}.tar.bz2 + gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch + gdk-pixbuf-0.22.0-bmp_secure.patch + gdk-pixbuf-0.22.0-loaders.patch + gdk-pixbuf-0.22.0.patch + libpng15.patch) +md5sums=('05fcb68ceaa338614ab650c775efc2f2' + 'd1fb93f1ae994875158a7e0c108c36f8' + '5f59d5772b1482d885a180dbc581cf84' + '3cf31ae0509747f72ac27a9fd96109c2' + 'e0f5f301ce958b7cea0be631ed7b8e56' + '16db4dc83d507ebcf15d1beb753a77bc') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + export SED=/bin/sed + patch -Np1 -i ${srcdir}/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch + patch -Np0 -i ${srcdir}/gdk-pixbuf-0.22.0-bmp_secure.patch + patch -Np1 -i ${srcdir}/gdk-pixbuf-0.22.0-loaders.patch + patch -Np0 -i ${srcdir}/gdk-pixbuf-0.22.0.patch + patch -Np1 -i ${srcdir}/libpng15.patch + sed -i \ + -e 's|AM_CONFIG_HEADER|AC_CONFIG_HEADER|' \ + -e 's|AM_PROG_CC_STDC|AC_PROG_CC|' \ + configure.in + libtoolize --force --copy --automake + autoreconf --force --install + ./configure --prefix=/usr --disable-gtk-doc + make +} + +package() { + cd ${srcdir}/${pkgname}-${pkgver} + make DESTDIR=${pkgdir} install + rm -rf ${pkgdir}/usr/share/gnome +} diff --git a/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch b/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch new file mode 100644 index 000000000..ffb4378aa --- /dev/null +++ b/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch @@ -0,0 +1,48 @@ +--- gdk-pixbuf-0.22.0/gdk-pixbuf/io-bmp.c 2002-09-27 23:12:40.000000000 +0200 ++++ gdk-pixbuf-0.22.0.patched/gdk-pixbuf/io-bmp.c 2005-03-30 01:33:06.000000000 +0200 +@@ -31,8 +31,6 @@ + #include "gdk-pixbuf-private.h" + #include "gdk-pixbuf-io.h" + +- +- + #if 0 + /* If these structures were unpacked, they would define the two headers of the + * BMP file. After them comes the palette, and then the image data. +@@ -206,7 +204,7 @@ + + if (State == NULL) + return NULL; +- ++ + while (feof(f) == 0) { + length = fread(membuf, 1, sizeof (membuf), f); + if (length > 0) +@@ -245,11 +243,26 @@ + static gboolean + grow_buffer (struct bmp_progressive_state *State) + { +- guchar *tmp = realloc (State->buff, State->BufferSize); ++ guchar *tmp; ++ ++ if (State->BufferSize == 0) { ++#if 0 ++ g_set_error (error, ++ GDK_PIXBUF_ERROR, ++ GDK_PIXBUF_ERROR_CORRUPT_IMAGE, ++ _("BMP image has bogus header data")); ++#endif ++ State->read_state = READ_STATE_ERROR; ++ return FALSE; ++ } ++ ++ tmp = realloc (State->buff, State->BufferSize); ++ + if (!tmp) { + State->read_state = READ_STATE_ERROR; + return FALSE; + } ++ + State->buff = tmp; + return TRUE; + } diff --git a/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_secure.patch b/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_secure.patch new file mode 100644 index 000000000..29471f147 --- /dev/null +++ b/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_secure.patch @@ -0,0 +1,19 @@ +Index: io-bmp.c +=================================================================== +RCS file: /cvs/gnome/gtk+/gdk-pixbuf/io-bmp.c,v +retrieving revision 1.41 +diff -u -p -r1.41 io-bmp.c +--- gdk-pixbuf/io-bmp.c 13 Aug 2004 02:26:57 -0000 1.41 ++++ gdk-pixbuf/io-bmp.c 20 Aug 2004 00:18:14 -0000 +@@ -876,8 +876,10 @@ DoCompressed(struct bmp_progressive_stat + guchar c; + gint idx; + +- if (context->compr.y >= context->Header.height) ++ if (context->compr.y >= context->Header.height) { ++ context->BufferDone = 0; + return TRUE; ++ } + + y = context->compr.y; + diff --git a/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-loaders.patch b/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-loaders.patch new file mode 100644 index 000000000..068653808 --- /dev/null +++ b/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0-loaders.patch @@ -0,0 +1,134 @@ +diff -NurdB gdk-pixbuf-0.22.0/gdk-pixbuf/io-ico.c gdk-pixbuf-0.22.0-patched/gdk-pixbuf/io-ico.c +--- gdk-pixbuf-0.22.0/gdk-pixbuf/io-ico.c 2002-09-27 17:19:15.000000000 -0500 ++++ gdk-pixbuf-0.22.0-patched/gdk-pixbuf/io-ico.c 2005-10-27 11:28:23.000000000 -0500 +@@ -330,6 +330,9 @@ + + State->HeaderSize+=I; + ++ if (State->HeaderSize < 0) ++ return FALSE; ++ + if (State->HeaderSize>State->BytesInHeaderBuf) { + guchar *tmp=realloc(State->HeaderBuf,State->HeaderSize); + if (!tmp) +diff -NurdB gdk-pixbuf-0.22.0/gdk-pixbuf/io-xpm.c gdk-pixbuf-0.22.0-patched/gdk-pixbuf/io-xpm.c +--- gdk-pixbuf-0.22.0/gdk-pixbuf/io-xpm.c 2001-03-01 15:16:28.000000000 -0500 ++++ gdk-pixbuf-0.22.0-patched/gdk-pixbuf/io-xpm.c 2005-10-27 11:29:14.000000000 -0500 +@@ -243,8 +243,8 @@ + break; + else { + if (numnames > 0) { +- space -= 1; +- strcat (color, " "); ++ strncat (color, " ", space); ++ space -= MIN (space, 1); + } + + strncat (color, temp, space); +@@ -281,7 +281,8 @@ + /* Fall through to the xpm_read_string. */ + + case op_body: +- xpm_read_string (h->infile, &h->buffer, &h->buffer_size); ++ if(!xpm_read_string (h->infile, &h->buffer, &h->buffer_size)) ++ return NULL; + return h->buffer; + + default: +@@ -317,13 +318,6 @@ + return NULL; + } + +-/* Destroy notification function for the pixbuf */ +-static void +-free_buffer (guchar *pixels, gpointer data) +-{ +- free (pixels); +-} +- + static gboolean + xpm_color_parse (const char *spec, XColor *color) + { +@@ -342,7 +336,8 @@ + gchar pixel_str[32]; + GHashTable *color_hash; + _XPMColor *colors, *color, *fallbackcolor; +- guchar *pixels, *pixtmp; ++ guchar *pixtmp; ++ GdkPixbuf* pixbuf; + + fallbackcolor = NULL; + +@@ -352,16 +347,33 @@ + return NULL; + } + sscanf (buffer, "%d %d %d %d", &w, &h, &n_col, &cpp); +- if (cpp >= 32) { +- g_warning ("XPM has more than 31 chars per pixel."); ++ if (cpp <= 0 || cpp >= 32) { ++ g_warning ("XPM has invalid number of chars per pixel."); + return NULL; + } ++ if (n_col <= 0 || ++ n_col >= G_MAXINT / (cpp + 1) || ++ n_col >= G_MAXINT / sizeof (_XPMColor)) { ++ g_warning ("XPM file has invalid number of colors"); ++ return NULL; ++ } + + /* The hash is used for fast lookups of color from chars */ + color_hash = g_hash_table_new (g_str_hash, g_str_equal); + +- name_buf = g_new (gchar, n_col * (cpp + 1)); +- colors = g_new (_XPMColor, n_col); ++ name_buf = g_new (gchar, n_col * (cpp + 1)); ++ if (!name_buf) { ++ g_warning ("Cannot allocate memory for loading XPM image"); ++ g_hash_table_destroy (color_hash); ++ return NULL; ++ } ++ colors = g_new (_XPMColor, n_col); ++ if (!colors) { ++ g_warning ("Cannot allocate memory for loading XPM image"); ++ g_hash_table_destroy (color_hash); ++ g_free (name_buf); ++ return NULL; ++ } + + for (cnt = 0; cnt < n_col; cnt++) { + gchar *color_name; +@@ -397,12 +409,8 @@ + fallbackcolor = color; + } + +- if (is_trans) +- pixels = malloc (w * h * 4); +- else +- pixels = malloc (w * h * 3); +- +- if (!pixels) { ++ pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, is_trans, 8, w, h); ++ if (!pixbuf) { + g_hash_table_destroy (color_hash); + g_free (colors); + g_free (name_buf); +@@ -410,7 +418,7 @@ + } + + wbytes = w * cpp; +- pixtmp = pixels; ++ pixtmp = pixbuf->pixels; + + for (ycnt = 0; ycnt < h; ycnt++) { + buffer = (*get_buf) (op_body, handle); +@@ -443,9 +451,7 @@ + g_free (colors); + g_free (name_buf); + +- return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, is_trans, 8, +- w, h, is_trans ? (w * 4) : (w * 3), +- free_buffer, NULL); ++ return pixbuf; + } + + /* Shared library entry point for file loading */ diff --git a/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0.patch b/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0.patch new file mode 100644 index 000000000..8e0f55680 --- /dev/null +++ b/pcr/gdk-pixbuf/gdk-pixbuf-0.22.0.patch @@ -0,0 +1,129 @@ +--- configure.in ++++ configure.in +@@ -21,6 +21,7 @@ + AC_PROG_CC + AC_ISC_POSIX + AM_PROG_CC_STDC ++AM_PROG_AS + AC_PROG_INSTALL + AC_PROG_LN_S + AC_PROG_MAKE_SET +@@ -147,18 +148,18 @@ + dnl Test for libtiff + if test -z "$LIBTIFF"; then + AC_CHECK_LIB(tiff, TIFFReadScanline, +- AC_CHECK_HEADER(tiffio.h, ++ [AC_CHECK_HEADER(tiffio.h, + TIFF='tiff'; LIBTIFF='-ltiff', +- AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)), +- AC_CHECK_LIB(tiff, TIFFWriteScanline, +- AC_CHECK_HEADER(tiffio.h, ++ AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))], ++ [AC_CHECK_LIB(tiff, TIFFWriteScanline, ++ [AC_CHECK_HEADER(tiffio.h, + TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz', +- AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)), +- AC_CHECK_LIB(tiff34, TIFFFlushData, +- AC_CHECK_HEADER(tiffio.h, ++ AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))], ++ [AC_CHECK_LIB(tiff34, TIFFFlushData, ++ [AC_CHECK_HEADER(tiffio.h, + TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz', +- AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)), +- AC_MSG_WARN(*** TIFF plug-in will not be built (TIFF library not found) ***), -ljpeg -lz -lm), -ljpeg -lz -lm), -lm) ++ AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))], ++ AC_MSG_WARN(*** TIFF plug-in will not be built (TIFF library not found) ***), -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm) + fi + + dnl Test for libjpeg +@@ -191,9 +192,9 @@ + dnl Test for libpng + if test -z "$LIBPNG"; then + AC_CHECK_LIB(png, png_read_info, +- AC_CHECK_HEADER(png.h, ++ [AC_CHECK_HEADER(png.h, + png_ok=yes, +- png_ok=no), ++ png_ok=no)], + AC_MSG_WARN(*** PNG loader will not be built (PNG library not found) ***), -lz -lm) + if test "$png_ok" = yes; then + AC_MSG_CHECKING([for png_structp in png.h]) +--- doc/Makefile.am ++++ doc/Makefile.am +@@ -156,7 +156,7 @@ + done; \ + fi) + # echo '-- Installing $(srcdir)/html/index.sgml' ; \ +-# $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \ ++# $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); + + # + # Require gtk-doc when making dist +--- gdk-pixbuf.m4 ++++ gdk-pixbuf.m4 +@@ -9,7 +9,7 @@ + dnl AM_PATH_GDK_PIXBUF([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) + dnl Test for GDK_PIXBUF, and define GDK_PIXBUF_CFLAGS and GDK_PIXBUF_LIBS + dnl +-AC_DEFUN(AM_PATH_GDK_PIXBUF, ++AC_DEFUN([AM_PATH_GDK_PIXBUF], + [dnl + dnl Get the cflags and libraries from the gdk-pixbuf-config script + dnl +--- gdk-pixbuf/Makefile.am ++++ gdk-pixbuf/Makefile.am +@@ -18,7 +18,7 @@ + + libgnomecanvaspixbuf_la_LDFLAGS = -version-info 1:0:0 $(EXTRA_GNOME_LIBS) + +-libexecdir = $(libdir)/gdk-pixbuf/loaders ++loaderdir = $(libdir)/gdk-pixbuf/loaders + + # + # The PNG plugin. +@@ -118,7 +118,7 @@ + + if BUILD_DYNAMIC_MODULES + +-libexec_LTLIBRARIES = \ ++loader_LTLIBRARIES = \ + $(PNG_LIB) \ + $(JPEG_LIB) \ + $(GIF_LIB) \ +@@ -134,7 +134,7 @@ + extra_sources = + + else +-libexec_LTLIBRARIES = ++loader_LTLIBRARIES = + + extra_sources = $(libpixbufloader_png_la_SOURCES) \ + $(libpixbufloader_jpeg_la_SOURCES) \ +@@ -159,7 +159,7 @@ + -I$(top_builddir)/gdk-pixbuf \ + $(X11_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS) $(GNOME_CFLAGS) + +-AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(libexecdir)\"" ++AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(loaderdir)\"" + + LDADDS = libgdk_pixbuf.la $(GLIB_LIBS) $(GTK_LIBS) $(STATIC_LIB_DEPS) + +@@ -211,7 +211,7 @@ + gdk-pixbuf-parse-color.c \ + $(extra_sources) + +-libgdk_pixbuf_xlib_la_LDFLAGS = -version-info 2:0:0 -export-dynamic $(GLIB_LIBS) $(X11_LIBS) ++libgdk_pixbuf_xlib_la_LDFLAGS = -version-info 2:0:0 -export-dynamic $(GLIB_LIBS) + libgdk_pixbuf_xlib_la_LIBADD = pixops/libpixops.la libgdk_pixbuf.la $(GTK_LIBS) + + +--- gdk-pixbuf/io-bmp.c ++++ gdk-pixbuf/io-bmp.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include "gdk-pixbuf-private.h" + #include "gdk-pixbuf-io.h" + diff --git a/pcr/gdk-pixbuf/libpng15.patch b/pcr/gdk-pixbuf/libpng15.patch new file mode 100644 index 000000000..e667288f8 --- /dev/null +++ b/pcr/gdk-pixbuf/libpng15.patch @@ -0,0 +1,30 @@ +diff -wbBur gdk-pixbuf-0.22.0/gdk-pixbuf/io-png.c gdk-pixbuf-0.22.0.my/gdk-pixbuf/io-png.c +--- gdk-pixbuf-0.22.0/gdk-pixbuf/io-png.c 2001-01-24 23:59:23.000000000 +0300 ++++ gdk-pixbuf-0.22.0.my/gdk-pixbuf/io-png.c 2012-01-23 13:33:08.000000000 +0400 +@@ -175,7 +175,7 @@ + return NULL; + } + +- if (setjmp (png_ptr->jmpbuf)) { ++ if (setjmp (png_jmpbuf(png_ptr))) { + png_destroy_read_struct (&png_ptr, &info_ptr, &end_info); + return NULL; + } +@@ -311,7 +311,7 @@ + return NULL; + } + +- if (setjmp (lc->png_read_ptr->jmpbuf)) { ++ if (setjmp (png_jmpbuf(lc->png_read_ptr))) { + if (lc->png_info_ptr) + png_destroy_read_struct(&lc->png_read_ptr, NULL, NULL); + g_free(lc); +@@ -366,7 +366,7 @@ + lc->max_row_seen_in_chunk = -1; + + /* Invokes our callbacks as needed */ +- if (setjmp (lc->png_read_ptr->jmpbuf)) { ++ if (setjmp (png_jmpbuf(lc->png_read_ptr))) { + return FALSE; + } else { + png_process_data(lc->png_read_ptr, lc->png_info_ptr, buf, size); -- cgit v1.2.3