public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: media-libs/gd/, media-libs/gd/files/
@ 2016-03-12 11:18 Markus Meier
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Meier @ 2016-03-12 11:18 UTC (permalink / raw
  To: gentoo-commits

commit:     13f429c8a0b8dd1d56e98c84108a20b5b5db9d6f
Author:     Markus Meier <maekke <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 12 11:18:29 2016 +0000
Commit:     Markus Meier <maekke <AT> gentoo <DOT> org>
CommitDate: Sat Mar 12 11:18:29 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=13f429c8

media-libs/gd: remove old for bug #538686

Package-Manager: portage-2.2.27

 media-libs/gd/Manifest                             |   1 -
 media-libs/gd/files/gd-2.0.35-fontconfig.patch     |  25 -----
 .../gd/files/gd-2.0.35-libpng-pkg-config.patch     | 113 ---------------------
 media-libs/gd/files/gd-2.0.35-libpng14.patch       |  16 ---
 media-libs/gd/files/gd-2.0.35-maxcolors.patch      |  17 ----
 media-libs/gd/gd-2.0.35-r3.ebuild                  |  69 -------------
 media-libs/gd/gd-2.0.35-r4.ebuild                  | 101 ------------------
 media-libs/gd/gd-2.1.1.ebuild                      |  59 -----------
 8 files changed, 401 deletions(-)

diff --git a/media-libs/gd/Manifest b/media-libs/gd/Manifest
index 8fc786d..3703145 100644
--- a/media-libs/gd/Manifest
+++ b/media-libs/gd/Manifest
@@ -1,2 +1 @@
-DIST gd-2.0.35.tar.bz2 1212730 SHA256 bf222490749d2a9a9ac3593b01eb55aed98461ff81202414707f61b42aa300f9 SHA512 eef8150adc040bed920155337211864a41ae3c4532e852ad443a3a3b9ffdc7fd3130698041b7b19b0b1207e78a80c263c6da26eba7208cdeeff78283c7d0d281 WHIRLPOOL 9eca23a184106652ef5c19ee3b5c18e23d742e21103c66907bf829910b95aa92eea7620c5579bf493c14730bc0327a4d662ffaf9bf9a5538127b8c10cc9c6b84
 DIST libgd-2.1.1.tar.xz 2039132 SHA256 9ada1ed45594abc998ebc942cef12b032fbad672e73efc22bc9ff54f5df2b285 SHA512 48f444402a4b89e412870f9091b92eb26136c5c0d795722262ad973c7d4103476204a2de36133a2634b8f410d6bccdcf60afb829a74ac2fddfb96aff2cd2567b WHIRLPOOL a38cf1f060db35d247b54038e731484e6230cd8a9da263a8c4823aaf6b3ce455c0747bbbde60f131d85a48340e39a5c8d6273fa51366cbe2436530520211a238

diff --git a/media-libs/gd/files/gd-2.0.35-fontconfig.patch b/media-libs/gd/files/gd-2.0.35-fontconfig.patch
deleted file mode 100644
index ca31302..0000000
--- a/media-libs/gd/files/gd-2.0.35-fontconfig.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-fix from upstream
-
-http://bugs.gentoo.org/363367
-
-# HG changeset patch
-# User tabe
-# Date 1239812355 0
-# Node ID 3ea283efcdafcb2acc1dd0ace1d3d48da6d8cec8
-# Parent  4f29a877875f63cee5a64e7bea406a61882a565e
-fixed FS#199
-
-199, Fixed useFontConfig() to work as documented (Ethan Merritt)
- 
-diff -r 4f29a877875f -r 3ea283efcdaf src/gdft.c
---- a/src/gdft.c	Sat Apr 04 12:00:37 2009 +0000
-+++ b/src/gdft.c	Wed Apr 15 16:19:15 2009 +0000
-@@ -1688,7 +1688,7 @@
- BGD_DECLARE(int) gdFTUseFontConfig(int flag)
- {
- #ifdef HAVE_LIBFONTCONFIG
--	fontConfigFlag = 1;
-+	fontConfigFlag = flag;
- 	return 1;
- #else
- 	return 0;

diff --git a/media-libs/gd/files/gd-2.0.35-libpng-pkg-config.patch b/media-libs/gd/files/gd-2.0.35-libpng-pkg-config.patch
deleted file mode 100644
index 4b8971f..0000000
--- a/media-libs/gd/files/gd-2.0.35-libpng-pkg-config.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-use libpng's pkg-config files rather than the ugly xxx-config scripts
-
---- a/configure.ac
-+++ b/configure.ac
-@@ -47,6 +47,7 @@ AC_PROG_LIBTOOL
- AC_PROG_LN_S
- AC_PROG_MAKE_SET
- #AC_PROG_RANLIB
-+PKG_PROG_PKG_CONFIG
- 
- dnl may be required for freetype and Xpm
- AC_PATH_X
-@@ -340,74 +341,26 @@ AC_CHECK_LIB(z,deflate,
- dnl libpng is required
- AC_ARG_WITH(png,dnl
- [  --with-png=DIR          where to find the png library],,
--  withval=yes)
--
--# libpng12.so is a nightmare. We have to test separately for
--# libpng12-config and libpng-config. If we find libpng12-config,
--# we don't look for the other, which will just be a symlink to it,
--# confusing autoconf into thinking the library itself will be named -lpng,
--# which it won't be. Awful. This code will suffice unless the libpng
--# authors decide to do this AGAIN. Which I really hope they won't. TBB
--
--if test "$withval" != no; then
--  AC_PATH_PROG([LIBPNG12_CONFIG], [libpng12-config])
--  AC_PATH_PROG([LIBPNG_CONFIG], [libpng-config])
--  if test -n "$LIBPNG12_CONFIG"; then
--    libpng_CPPFLAGS=`libpng12-config --cflags`
--    # should be --ldopts, but it's currently broken
--    libpng_LDFLAGS=`libpng12-config --ldflags`
--    libpng_LDFLAGS=`echo " $libpng_LDFLAGS" | sed 's/ -l[[^ ]][[^ ]]*//g'`
--  elif test -n "$LIBPNG_CONFIG"; then
--    libpng_CPPFLAGS=`libpng-config --cflags`
--    # should be --ldopts, but it's currently broken
--    libpng_LDFLAGS=`libpng-config --ldflags`
--    libpng_LDFLAGS=`echo " $libpng_LDFLAGS" | sed 's/ -l[[^ ]][[^ ]]*//g'`
--  elif test -d "$withval"; then
--    libpng_CPPFLAGS="-I$withval/include"
--    libpng_LDFLAGS="-L$withval/lib"
--  fi
--
--  AC_CHECK_HEADERS(png.h,,
--    [AC_CHECK_HEADERS(libpng/png.h,
--       [CPPFLAGS="$CPPFLAGS $libpng_CPPFLAGS/libpng"],
--       [CPPFLAGS="$_cppflags"])])
--
--  _ldflags="$LDFLAGS"
--  LDFLAGS="$libpng_LDFLAGS $LDFLAGS"
--
--  if test -n "$LIBPNG12_CONFIG"; then
--    AC_CHECK_LIB(png12,png_create_read_struct,
--      [LIBS="-lpng12 $LIBS"
--       FEATURES="GD_PNG $FEATURES"
--       AC_DEFINE(HAVE_LIBPNG, 1, [ Define if you have the png library. ])],
--      [LDFLAGS="$_ldflags"  
--       AC_MSG_WARN([libpng is required - see http://www.libpng.org/pub/png/])])
--  elif test -n "$LIBPNG_CONFIG"; then
--    AC_CHECK_LIB(png,png_create_read_struct,
--      [LIBS="-lpng $LIBS" 
--       FEATURES="GD_PNG $FEATURES"
--       AC_DEFINE(HAVE_LIBPNG, 1, [ Define if you have the png library. ])],
--      [LDFLAGS="$_ldflags"  
--       AC_MSG_WARN([libpng is required - see http://www.libpng.org/pub/png/])])
--  else
--    AC_CHECK_LIB(png,png_create_read_struct,
--      [LIBS="-lpng $LIBS" 
--       FEATURES="GD_PNG $FEATURES"
--       AC_DEFINE(HAVE_LIBPNG, 1, [ Define if you have the png library. ])],
--      [LDFLAGS="$_ldflags"  
--       AC_MSG_WARN([libpng is required - see http://www.libpng.org/pub/png/])])
--  fi
--else
--  ac_cv_lib_png_png_create_read_struct=no
-+  with_png=detect)
-+
-+if test "$with_png" != no; then
-+  PKG_CHECK_MODULES([LIBPNG], libpng, [
-+    FEATURES="GD_PNG $FEATURES"
-+    AC_DEFINE(HAVE_LIBPNG, 1, [ Define if you have the png library. ])
-+    CPPFLAGS="$CPPFLAGS $LIBPNG_CFLAGS"
-+    LDFLAGS="$LDFLAGS $LIBPNG_LIBS"
-+    with_png=yes
-+  ],[
-+    if test "$with_png" = yes; then
-+      AC_MSG_ERROR([png support requested, but not found])
-+    fi
-+    with_png=no
-+  ])
-+fi
-+if test "$with_png" = no; then
-   AC_MSG_WARN([libpng is required - see http://www.libpng.org/pub/png/])
- fi
- 
--#TBB: png12's png_create_read_struct is just as good 
--#2.0.23: should be = not ==  
--if test "$ac_cv_lib_png12_png_create_read_struct" = yes; then
--  ac_cv_lib_png_png_create_read_struct=yes
--fi 
--
- dnl FreeType configure tests snarfed from libwmf ..
- AC_ARG_WITH(freetype,dnl
- [  --with-freetype=DIR     where to find the freetype 2.x library],
-@@ -528,7 +481,7 @@ dnl report configuration
- AC_MSG_RESULT([
- ** Configuration summary for $PACKAGE $VERSION:
- 
--   Support for PNG library:          $ac_cv_lib_png_png_create_read_struct
-+   Support for PNG library:          $with_png
-    Support for JPEG library:         $ac_cv_lib_jpeg_jpeg_set_defaults
-    Support for Freetype 2.x library: $ac_cv_lib_freetype_FT_Init_FreeType
-    Support for Fontconfig library:   $ac_cv_lib_fontconfig_FcInit

diff --git a/media-libs/gd/files/gd-2.0.35-libpng14.patch b/media-libs/gd/files/gd-2.0.35-libpng14.patch
deleted file mode 100644
index 46e621e..0000000
--- a/media-libs/gd/files/gd-2.0.35-libpng14.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-http://bugs.gentoo.org/305101
-http://repos.archlinux.org/wsvn/packages/gd/trunk/libpng14.patch
-
-patch in upstream repo already
-
---- gd_png.c
-+++ gd_png.c
-@@ -149,7 +149,7 @@
- 	return NULL;
-   }
- 
--	if (!png_check_sig (sig, 8)) { /* bad signature */
-+	if (png_sig_cmp (sig, 0, 8)) { /* bad signature */
-     	return NULL;		/* bad signature */
- 	}
-

diff --git a/media-libs/gd/files/gd-2.0.35-maxcolors.patch b/media-libs/gd/files/gd-2.0.35-maxcolors.patch
deleted file mode 100644
index 7d6852e..0000000
--- a/media-libs/gd/files/gd-2.0.35-maxcolors.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-http://bugs.gentoo.org/292130
-
-fix in usptream repo already
-
---- gd-2.0.35/gd_gd.c
-+++ gd-2.0.35/gd_gd.c
-@@ -44,6 +44,10 @@
- 	    {
- 	      goto fail1;
- 	    }
-+	  if (im->colorsTotal > gdMaxColors)
-+	    {
-+		   goto fail1;
-+		 }
- 	}
-       /* Int to accommodate truecolor single-color transparency */
-       if (!gdGetInt (&im->transparent, in))

diff --git a/media-libs/gd/gd-2.0.35-r3.ebuild b/media-libs/gd/gd-2.0.35-r3.ebuild
deleted file mode 100644
index 6363cfa..0000000
--- a/media-libs/gd/gd-2.0.35-r3.ebuild
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="2"
-
-inherit autotools eutils
-
-DESCRIPTION="A graphics library for fast image creation"
-HOMEPAGE="http://libgd.org/ http://www.boutell.com/gd/"
-SRC_URI="http://libgd.org/releases/${P}.tar.bz2"
-
-LICENSE="gd IJG HPND BSD"
-SLOT="2"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
-IUSE="fontconfig jpeg png static-libs truetype xpm zlib"
-
-RDEPEND="fontconfig? ( media-libs/fontconfig )
-	jpeg? ( virtual/jpeg:0 )
-	png? ( >=media-libs/libpng-1.2:0 )
-	truetype? ( >=media-libs/freetype-2.1.5 )
-	xpm? ( x11-libs/libXpm x11-libs/libXt )
-	zlib? ( sys-libs/zlib )"
-DEPEND="${RDEPEND}
-	virtual/pkgconfig"
-
-src_prepare() {
-	epatch "${FILESDIR}"/${P}-libpng14.patch #305101
-	epatch "${FILESDIR}"/${P}-maxcolors.patch #292130
-	epatch "${FILESDIR}"/${P}-fontconfig.patch #363367
-	epatch "${FILESDIR}"/${P}-libpng-pkg-config.patch
-
-	# Avoid programs we never install
-	local make_sed=( -e '/^noinst_PROGRAMS/s:noinst:check:' )
-	use png || make_sed+=( -e '/_PROGRAMS/s:(gdparttopng|gdtopng|gd2topng|pngtogd|pngtogd2|webpng)::g' )
-	use zlib || make_sed+=( -e '/_PROGRAMS/s:(gd2topng|gd2copypal|gd2togif|giftogd2|gdparttopng|pngtogd2)::g' )
-	sed -i -r "${make_sed[@]}" Makefile.am || die
-
-	# bug 466996
-	sed -i 's/AM_PROG_CC_STDC/AC_PROG_CC/' configure.ac || die
-
-	cat <<-EOF > acinclude.m4
-	m4_ifndef([AM_ICONV],[m4_define([AM_ICONV],[:])])
-	EOF
-
-	eautoreconf
-}
-
-src_configure() {
-	export ac_cv_lib_z_deflate=$(usex zlib)
-	# we aren't actually {en,dis}abling X here ... the configure
-	# script uses it just to add explicit -I/-L paths which we
-	# don't care about on Gentoo systems.
-	econf \
-		--without-x \
-		$(use_enable static-libs static) \
-		$(use_with fontconfig) \
-		$(use_with png) \
-		$(use_with truetype freetype) \
-		$(use_with jpeg) \
-		$(use_with xpm)
-}
-
-src_install() {
-	emake DESTDIR="${D}" install || die
-	dodoc INSTALL README*
-	dohtml -r ./
-	use static-libs || rm -f "${D}"/usr/*/libgd.la
-}

diff --git a/media-libs/gd/gd-2.0.35-r4.ebuild b/media-libs/gd/gd-2.0.35-r4.ebuild
deleted file mode 100644
index 6fbbc35..0000000
--- a/media-libs/gd/gd-2.0.35-r4.ebuild
+++ /dev/null
@@ -1,101 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit autotools eutils flag-o-matic multilib-minimal
-
-DESCRIPTION="A graphics library for fast image creation"
-HOMEPAGE="http://libgd.org/ http://www.boutell.com/gd/"
-SRC_URI="http://libgd.org/releases/${P}.tar.bz2"
-
-LICENSE="gd IJG HPND BSD"
-SLOT="2"
-KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
-IUSE="fontconfig jpeg png static-libs truetype xpm zlib"
-
-#fontconfig has prefixed font paths, details see bug #518970
-REQUIRED_USE="prefix? ( fontconfig )"
-
-RDEPEND="fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] )
-	jpeg? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] )
-	png? ( >=media-libs/libpng-1.6.10:0=[${MULTILIB_USEDEP}] )
-	truetype? ( >=media-libs/freetype-2.5.0.1[${MULTILIB_USEDEP}] )
-	xpm? ( >=x11-libs/libXpm-3.5.10-r1[${MULTILIB_USEDEP}] >=x11-libs/libXt-1.1.4[${MULTILIB_USEDEP}] )
-	zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
-DEPEND="${RDEPEND}
-	>=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
-
-MULTILIB_CHOST_TOOLS=(
-	/usr/bin/gdlib-config
-)
-
-src_prepare() {
-	epatch "${FILESDIR}"/${P}-libpng14.patch #305101
-	epatch "${FILESDIR}"/${P}-maxcolors.patch #292130
-	epatch "${FILESDIR}"/${P}-fontconfig.patch #363367
-	epatch "${FILESDIR}"/${P}-libpng-pkg-config.patch
-
-	# Avoid programs we never install
-	local make_sed=( -e '/^noinst_PROGRAMS/s:noinst:check:' )
-	use png || make_sed+=( -e '/_PROGRAMS/s:(gdparttopng|gdtopng|gd2topng|pngtogd|pngtogd2|webpng)::g' )
-	use zlib || make_sed+=( -e '/_PROGRAMS/s:(gd2topng|gd2copypal|gd2togif|giftogd2|gdparttopng|pngtogd2)::g' )
-	sed -i -r "${make_sed[@]}" Makefile.am || die
-
-	# bug 466996
-	sed -i 's/AM_PROG_CC_STDC/AC_PROG_CC/' configure.ac || die
-
-	cat <<-EOF > acinclude.m4
-	m4_ifndef([AM_ICONV],[m4_define([AM_ICONV],[AC_SUBST(LIBICONV)])])
-	EOF
-
-	eautoreconf
-}
-
-multilib_src_configure() {
-	# setup a default FONT path that has a chance of existing using corefonts,
-	# as to make it more useful with e.g. gnuplot
-	local fontpath="${EPREFIX}/usr/share/fonts/corefonts"
-	# like with fontconfig, try to use fonts from the host OS, because that's
-	# beneficial for the user
-	use prefix && case ${CHOST} in
-		*-darwin*)
-			fontpath+=":/Library/Fonts:/System/Library/Fonts"
-		;;
-		*-solaris*)
-			[[ -d /usr/X/lib/X11/fonts/TrueType ]] && \
-				fontpath+=":/usr/X/lib/X11/fonts/TrueType"
-			[[ -d /usr/X/lib/X11/fonts/Type1 ]] && \
-				fontpath+=":/usr/X/lib/X11/fonts/Type1"
-			# OpenIndiana
-			[[ -d /usr/share/fonts/X11/Type1 ]] && \
-				fontpath+=":/usr/share/fonts/X11/Type1"
-		;;
-		*-linux-gnu)
-			[[ -d /usr/share/fonts/truetype ]] && \
-				fontpath+=":/usr/share/fonts/truetype"
-		;;
-	esac
-	append-cppflags "-DDEFAULT_FONTPATH=\\\"${fontpath}\\\""
-
-	export ac_cv_lib_z_deflate=$(usex zlib)
-	# we aren't actually {en,dis}abling X here ... the configure
-	# script uses it just to add explicit -I/-L paths which we
-	# don't care about on Gentoo systems.
-	ECONF_SOURCE=${S} \
-	econf \
-		--without-x \
-		$(use_enable static-libs static) \
-		$(use_with fontconfig) \
-		$(use_with png) \
-		$(use_with truetype freetype) \
-		$(use_with jpeg) \
-		$(use_with xpm)
-}
-
-multilib_src_install_all() {
-	dodoc INSTALL README*
-	dohtml -r ./
-	prune_libtool_files
-}

diff --git a/media-libs/gd/gd-2.1.1.ebuild b/media-libs/gd/gd-2.1.1.ebuild
deleted file mode 100644
index e79bcb0..0000000
--- a/media-libs/gd/gd-2.1.1.ebuild
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-inherit libtool multilib-minimal eutils
-
-DESCRIPTION="A graphics library for fast image creation"
-HOMEPAGE="http://libgd.org/ http://www.boutell.com/gd/"
-SRC_URI="https://bitbucket.org/libgd/gd-libgd/downloads/lib${P}.tar.xz"
-
-LICENSE="gd IJG HPND BSD"
-SLOT="2/3"
-KEYWORDS="alpha amd64 ~arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
-IUSE="fontconfig jpeg png static-libs truetype webp xpm zlib"
-
-# fontconfig has prefixed font paths, details see bug #518970
-REQUIRED_USE="prefix? ( fontconfig )"
-
-RDEPEND="fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] )
-	jpeg? ( >=virtual/jpeg-0-r2:0[${MULTILIB_USEDEP}] )
-	png? ( >=media-libs/libpng-1.6.10:0[${MULTILIB_USEDEP}] )
-	truetype? ( >=media-libs/freetype-2.5.0.1[${MULTILIB_USEDEP}] )
-	webp? ( <media-libs/libvpx-1.4.0[${MULTILIB_USEDEP}] )
-	xpm? ( >=x11-libs/libXpm-3.5.10-r1[${MULTILIB_USEDEP}] >=x11-libs/libXt-1.1.4[${MULTILIB_USEDEP}] )
-	zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
-DEPEND="${RDEPEND}
-	>=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
-
-S="${WORKDIR}/lib${P}"
-
-src_prepare() {
-	epatch "${FILESDIR}/${P}-headers.patch" #540376
-
-	elibtoolize  # for shared library on Solaris
-}
-
-multilib_src_configure() {
-	# we aren't actually {en,dis}abling X here ... the configure
-	# script uses it just to add explicit -I/-L paths which we
-	# don't care about on Gentoo systems.
-	ECONF_SOURCE=${S} \
-	econf \
-		--without-x \
-		$(use_enable static-libs static) \
-		$(use_with fontconfig) \
-		$(use_with png) \
-		$(use_with truetype freetype) \
-		$(use_with jpeg) \
-		$(use_with webp vpx) \
-		$(use_with xpm) \
-		$(use_with zlib)
-}
-
-multilib_src_install_all() {
-	dodoc NEWS README
-	prune_libtool_files
-}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/gd/, media-libs/gd/files/
@ 2016-11-02 18:54 Markus Meier
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Meier @ 2016-11-02 18:54 UTC (permalink / raw
  To: gentoo-commits

commit:     7492ba6074ec9a5c1e726b553faa6878dbae6d95
Author:     Markus Meier <maekke <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  2 18:52:40 2016 +0000
Commit:     Markus Meier <maekke <AT> gentoo <DOT> org>
CommitDate: Wed Nov  2 18:52:40 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7492ba60

media-libs/gd: remove old, bug #587662

Package-Manager: portage-2.3.2

 media-libs/gd/Manifest                         |  1 -
 media-libs/gd/files/gd-2.2.2-osx-libtool.patch | 37 ---------------
 media-libs/gd/gd-2.2.2.ebuild                  | 65 --------------------------
 3 files changed, 103 deletions(-)

diff --git a/media-libs/gd/Manifest b/media-libs/gd/Manifest
index fb5be03..49ca5f9 100644
--- a/media-libs/gd/Manifest
+++ b/media-libs/gd/Manifest
@@ -1,2 +1 @@
-DIST libgd-2.2.2.tar.xz 2105628 SHA256 489f756ce07f0c034b1a794f4d34fdb4d829256112cb3c36feb40bb56b79218c SHA512 65c2f22ff35b5d62889921d7963d9cf808700299aece9292716555ac544e8c52ca435d6c5f817610553162e249343868a9164bf0fef9d59b61cd8075334c7e8d WHIRLPOOL 862588677be868c56af7c312e4aa66a5e67f10ccbc3cc7209b0fd23bcc3aae594c1e092b4b08ca7f913b334be47a486e696bced69d3f461056649f9ea8cc130d
 DIST libgd-2.2.3.tar.xz 2164152 SHA256 746b6cbd6769a22ff3ba6f5756f3512a769bd4cdf4695dff17f4867f25fa7d3c SHA512 bdc6d086bc054beda6574ec46baa4cd94048a5f2f357f875ba05983e92d247f1b731434b9e438c6aef09d46fa96f1a7e1f330a25a77ffd2dd78aa8a32d652557 WHIRLPOOL 1f290bb446618e402422488e77e1b88626ea3d9679653f10392b90386cf2ae861f9f8fdf624ebd96d152b764cfa3bf6f01859f58a033585db01ef8ea77c21e1a

diff --git a/media-libs/gd/files/gd-2.2.2-osx-libtool.patch b/media-libs/gd/files/gd-2.2.2-osx-libtool.patch
deleted file mode 100644
index 4d20f33..00000000
--- a/media-libs/gd/files/gd-2.2.2-osx-libtool.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-https://bugs.gentoo.org/583584
-https://github.com/libgd/libgd/issues/241
-
-From dd6615fd138e53656a7883015d4a6b2d02292b26 Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <vapier@gentoo.org>
-Date: Sat, 21 May 2016 15:00:53 -0400
-Subject: [PATCH] libtool: rework revision to fix OS X breakage
-
-It seems the OS X linker restricts the revision field to 8 bits.
-Rework how we calculate that value and pack it in closer to fit.
-It might produce some collisions if we get to like 2.2.8, but oh
-well ... this field doesn't need to be super exact.
-
-Fixes #214 and fixes #241.
----
- configure.ac | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
---- a/configure
-+++ b/configure
-@@ -2460,7 +2460,12 @@ AC_SUBST(GDLIB_VERSION)
- # See http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
- 
- GDLIB_LT_CURRENT=3
-+# This is the version where the soname (current above) changes.  We use it
-+# to reset the revision base back to zero.  It's a bit of a pain, but some
-+# systems restrict the revision range below to [0..255] (like OS X).
-+GDLIB_PREV_MAJOR=2
-+GDLIB_PREV_MINOR=2
--GDLIB_LT_REVISION=$(printf '%i%02i%02i' $GDLIB_MAJOR $GDLIB_MINOR $GDLIB_REVISION)
-+GDLIB_LT_REVISION=$(( ((GDLIB_MAJOR - GDLIB_PREV_MAJOR) << 6) | ((GDLIB_MINOR - GDLIB_PREV_MINOR) << 3) | GDLIB_REVISION ))
- GDLIB_LT_AGE=0
- 
- 
--- 
-2.8.2
-

diff --git a/media-libs/gd/gd-2.2.2.ebuild b/media-libs/gd/gd-2.2.2.ebuild
deleted file mode 100644
index 1666398..00000000
--- a/media-libs/gd/gd-2.2.2.ebuild
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit eutils libtool multilib-minimal
-
-DESCRIPTION="A graphics library for fast image creation"
-HOMEPAGE="http://libgd.org/ http://www.boutell.com/gd/"
-SRC_URI="https://github.com/libgd/libgd/releases/download/${P}/lib${P}.tar.xz"
-
-LICENSE="gd IJG HPND BSD"
-SLOT="2/3"
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
-IUSE="fontconfig jpeg png static-libs tiff truetype webp xpm zlib"
-
-# fontconfig has prefixed font paths, details see bug #518970
-REQUIRED_USE="prefix? ( fontconfig )"
-
-RDEPEND="fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] )
-	jpeg? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] )
-	png? ( >=media-libs/libpng-1.6.10:0=[${MULTILIB_USEDEP}] )
-	tiff? ( media-libs/tiff:0[${MULTILIB_USEDEP}] )
-	truetype? ( >=media-libs/freetype-2.5.0.1[${MULTILIB_USEDEP}] )
-	webp? ( media-libs/libwebp[${MULTILIB_USEDEP}] )
-	xpm? ( >=x11-libs/libXpm-3.5.10-r1[${MULTILIB_USEDEP}] >=x11-libs/libXt-1.1.4[${MULTILIB_USEDEP}] )
-	zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
-DEPEND="${RDEPEND}
-	>=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
-
-S="${WORKDIR}/lib${P}"
-
-PATCHES=(
-	"${FILESDIR}"/${P}-osx-libtool.patch #583584
-)
-
-src_prepare() {
-	default
-	elibtoolize  # for shared library on Solaris
-}
-
-multilib_src_configure() {
-	# we aren't actually {en,dis}abling X here ... the configure
-	# script uses it just to add explicit -I/-L paths which we
-	# don't care about on Gentoo systems.
-	ECONF_SOURCE=${S} \
-	econf \
-		--disable-werror \
-		--without-x \
-		--without-liq \
-		$(use_enable static-libs static) \
-		$(use_with fontconfig) \
-		$(use_with png) \
-		$(use_with tiff) \
-		$(use_with truetype freetype) \
-		$(use_with jpeg) \
-		$(use_with webp) \
-		$(use_with xpm) \
-		$(use_with zlib)
-}
-
-multilib_src_install_all() {
-	dodoc NEWS README.md
-	prune_libtool_files
-}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/gd/, media-libs/gd/files/
@ 2019-03-04  0:29 Thomas Deutschmann
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Deutschmann @ 2019-03-04  0:29 UTC (permalink / raw
  To: gentoo-commits

commit:     0c46087add86facfccbc875e0064cbc167775249
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  4 00:28:44 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Mar  4 00:28:59 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c46087a

media-libs/gd: rev bump to add some security patches

ossfuzz5700 fix
CVE-2018-5711
CVE-2019-6977
CVE-2019-6978

Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 media-libs/gd/Manifest                           |   2 +
 media-libs/gd/files/gd-2.2.5-CVE-2018-5711.patch | 124 ++++++++++
 media-libs/gd/files/gd-2.2.5-CVE-2019-6977.patch |  28 +++
 media-libs/gd/files/gd-2.2.5-CVE-2019-6978.patch | 278 +++++++++++++++++++++++
 media-libs/gd/files/gd-2.2.5-ossfuzz5700.patch   | 103 +++++++++
 media-libs/gd/gd-2.2.5-r2.ebuild                 |  82 +++++++
 6 files changed, 617 insertions(+)

diff --git a/media-libs/gd/Manifest b/media-libs/gd/Manifest
index 9957e0f8f60..986a6d40524 100644
--- a/media-libs/gd/Manifest
+++ b/media-libs/gd/Manifest
@@ -1 +1,3 @@
+DIST libgd-2.2.5-ossfuzz5700.dat 30 BLAKE2B 5ddd3d2be2adf05e1e2eb1852cc689be57d4d77c57b471e8b6021877f2fb137d15b4c73445fbb23a9ed585974a96dd154759a48712c1e7b5bdc5750d534aee4a SHA512 2394e92ff7a42c818e13a1ac9ad15bc81aa401adc917366ec8c440bb7f27a63777ab059aa03c501dafef0ac16b462dd23c7fb9f8086ce558203384a98a235fff
+DIST libgd-2.2.5-php_bug_75571.dat 1731 BLAKE2B 4b5d3f258b73e8089ede1b2c9f538855f410965a9e01e1f3f151ae52f072036172b184bd1a4d07b8355bb974bf088bebb0e812175a277bb67926274272bd80a0 SHA512 b3048640ce7828cca7901fadc989e867cfc6d31b44c0f5a1bda54d7428f317c8c8fc6403fef301e193869a95eb46eb7195d47710ec7f8c507ba049cb6cdcb281
 DIST libgd-2.2.5.tar.xz 2594092 BLAKE2B 222a7e012fbf9924ac391ee96c7cd3dec96afd78c6d43dfb680b33e7143e7df87fe6be75bbfe8fb93e916302d7daf08271214c84da28712e93a36465566cb2bd SHA512 e4598e17a277a75e02255402182cab139cb3f2cffcd68ec05cc10bbeaf6bc7aa39162c3445cd4a7efc1a26b72b9152bbedb187351e3ed099ea51767319997a6b

diff --git a/media-libs/gd/files/gd-2.2.5-CVE-2018-5711.patch b/media-libs/gd/files/gd-2.2.5-CVE-2018-5711.patch
new file mode 100644
index 00000000000..6d9de06998a
--- /dev/null
+++ b/media-libs/gd/files/gd-2.2.5-CVE-2018-5711.patch
@@ -0,0 +1,124 @@
+From a11f47475e6443b7f32d21f2271f28f417e2ac04 Mon Sep 17 00:00:00 2001
+From: "Christoph M. Becker" <cmbecker69@gmx.de>
+Date: Wed, 29 Nov 2017 19:37:38 +0100
+Subject: [PATCH] Fix #420: Potential infinite loop in gdImageCreateFromGifCtx
+
+Due to a signedness confusion in `GetCode_` a corrupt GIF file can
+trigger an infinite loop.  Furthermore we make sure that a GIF without
+any palette entries is treated as invalid *after* open palette entries
+have been removed.
+
+CVE-2018-5711
+
+See also https://bugs.php.net/bug.php?id=75571.
+---
+ src/gd_gif_in.c             |  12 ++++++------
+ tests/gif/CMakeLists.txt    |   1 +
+ tests/gif/Makemodule.am     |   2 ++
+ tests/gif/php_bug_75571.c   |  28 ++++++++++++++++++++++++++++
+ tests/gif/php_bug_75571.gif | Bin 0 -> 1731 bytes
+ 6 files changed, 38 insertions(+), 6 deletions(-)
+ create mode 100644 tests/gif/php_bug_75571.c
+
+diff --git a/src/gd_gif_in.c b/src/gd_gif_in.c
+index daf26e79..0a8bd717 100644
+--- a/src/gd_gif_in.c
++++ b/src/gd_gif_in.c
+@@ -335,11 +335,6 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx(gdIOCtxPtr fd)
+ 		return 0;
+ 	}
+ 
+-	if(!im->colorsTotal) {
+-		gdImageDestroy(im);
+-		return 0;
+-	}
+-
+ 	/* Check for open colors at the end, so
+ 	 * we can reduce colorsTotal and ultimately
+ 	 * BitsPerPixel */
+@@ -351,6 +346,11 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx(gdIOCtxPtr fd)
+ 		}
+ 	}
+ 
++	if(!im->colorsTotal) {
++		gdImageDestroy(im);
++		return 0;
++	}
++
+ 	return im;
+ }
+ 
+@@ -447,7 +447,7 @@ static int
+ GetCode_(gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroDataBlockP)
+ {
+ 	int i, j, ret;
+-	unsigned char count;
++	int count;
+ 
+ 	if(flag) {
+ 		scd->curbit = 0;
+diff --git a/tests/gif/CMakeLists.txt b/tests/gif/CMakeLists.txt
+index 2b73749e..e58e6b09 100644
+--- a/tests/gif/CMakeLists.txt
++++ b/tests/gif/CMakeLists.txt
+@@ -4,6 +4,7 @@ LIST(APPEND TESTS_FILES
+ 	bug00227
+ 	gif_null
+ 	ossfuzz5700
++	php_bug_75571
+ 	uninitialized_memory_read
+ )
+ 
+diff --git a/tests/gif/Makemodule.am b/tests/gif/Makemodule.am
+index 3199438f..5dbeac53 100644
+--- a/tests/gif/Makemodule.am
++++ b/tests/gif/Makemodule.am
+@@ -4,6 +4,7 @@ libgd_test_programs += \
+ 	gif/bug00227 \
+ 	gif/gif_null \
+ 	gif/ossfuzz5700 \
++	gif/php_bug_75571 \
+ 	gif/uninitialized_memory_read
+ 
+ if HAVE_LIBPNG
+@@ -26,4 +27,5 @@ EXTRA_DIST += \
+ 	gif/bug00066.gif \
+ 	gif/bug00066_exp.png \
+ 	gif/ossfuzz5700.gif \
++	gif/php_bug_75571.gif \
+ 	gif/unitialized_memory_read.gif
+diff --git a/tests/gif/php_bug_75571.c b/tests/gif/php_bug_75571.c
+new file mode 100644
+index 00000000..d4fae3ae
+--- /dev/null
++++ b/tests/gif/php_bug_75571.c
+@@ -0,0 +1,28 @@
++/**
++ * Test that GIF reading does not loop infinitely
++ * 
++ * We are reading a crafted GIF image which has been truncated.  This would
++ * trigger an infinite loop formerly, but know bails out early, returning
++ * NULL from gdImageCreateFromGif().
++ *
++ * See also https://bugs.php.net/bug.php?id=75571.
++ */
++
++
++#include "gd.h"
++#include "gdtest.h"
++
++
++int main()
++{
++    gdImagePtr im;
++    FILE *fp;
++
++    fp = gdTestFileOpen2("gif", "php_bug_75571.gif");
++    gdTestAssert(fp != NULL);
++    im = gdImageCreateFromGif(fp);
++    gdTestAssert(im == NULL);
++    fclose(fp);
++
++    return gdNumFailures();
++}
+

diff --git a/media-libs/gd/files/gd-2.2.5-CVE-2019-6977.patch b/media-libs/gd/files/gd-2.2.5-CVE-2019-6977.patch
new file mode 100644
index 00000000000..0b67a596c6b
--- /dev/null
+++ b/media-libs/gd/files/gd-2.2.5-CVE-2019-6977.patch
@@ -0,0 +1,28 @@
+Description: Heap-based buffer overflow in gdImageColorMatch
+Origin: other, https://gist.github.com/cmb69/1f36d285eb297ed326f5c821d7aafced
+Bug-PHP: https://bugs.php.net/bug.php?id=77270
+Bug-Debian: https://bugs.debian.org/920645
+Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2019-6977
+Forwarded: no
+Author: "Christoph M. Becker" <cmbecker69@gmx.de>
+Last-Update: 2019-02-01
+
+At least some of the image reading functions may return images which
+use color indexes greater than or equal to im->colorsTotal.  We cater
+to this by always using a buffer size which is sufficient for
+`gdMaxColors` in `gdImageColorMatch()`.
+---
+
+--- a/src/gd_color_match.c
++++ b/src/gd_color_match.c
+@@ -31,8 +31,8 @@ BGD_DECLARE(int) gdImageColorMatch (gdIm
+ 		return -4; /* At least 1 color must be allocated */
+ 	}
+ 
+-	buf = (unsigned long *)gdMalloc(sizeof(unsigned long) * 5 * im2->colorsTotal);
+-	memset (buf, 0, sizeof(unsigned long) * 5 * im2->colorsTotal );
++	buf = (unsigned long *)gdMalloc(sizeof(unsigned long) * 5 * gdMaxColors);
++	memset (buf, 0, sizeof(unsigned long) * 5 * gdMaxColors );
+ 
+ 	for (x=0; x < im1->sx; x++) {
+ 		for( y=0; y<im1->sy; y++ ) {

diff --git a/media-libs/gd/files/gd-2.2.5-CVE-2019-6978.patch b/media-libs/gd/files/gd-2.2.5-CVE-2019-6978.patch
new file mode 100644
index 00000000000..2eb9369a0ba
--- /dev/null
+++ b/media-libs/gd/files/gd-2.2.5-CVE-2019-6978.patch
@@ -0,0 +1,278 @@
+From 553702980ae89c83f2d6e254d62cf82e204956d0 Mon Sep 17 00:00:00 2001
+From: "Christoph M. Becker" <cmbecker69@gmx.de>
+Date: Thu, 17 Jan 2019 11:54:55 +0100
+Subject: [PATCH] Fix #492: Potential double-free in gdImage*Ptr()
+
+Whenever `gdImage*Ptr()` calls `gdImage*Ctx()` and the latter fails, we
+must not call `gdDPExtractData()`; otherwise a double-free would
+happen.  Since `gdImage*Ctx()` are void functions, and we can't change
+that for BC reasons, we're introducing static helpers which are used
+internally.
+
+We're adding a regression test for `gdImageJpegPtr()`, but not for
+`gdImageGifPtr()` and `gdImageWbmpPtr()` since we don't know how to
+trigger failure of the respective `gdImage*Ctx()` calls.
+
+This potential security issue has been reported by Solmaz Salimi (aka.
+Rooney).
+---
+ src/gd_gif_out.c                  | 18 +++++++++++++++---
+ src/gd_jpeg.c                     | 20 ++++++++++++++++----
+ src/gd_wbmp.c                     | 21 ++++++++++++++++++---
+ tests/jpeg/CMakeLists.txt         |  1 +
+ tests/jpeg/Makemodule.am          |  3 ++-
+ tests/jpeg/jpeg_ptr_double_free.c | 31 +++++++++++++++++++++++++++++++
+ 7 files changed, 84 insertions(+), 11 deletions(-)
+ create mode 100644 tests/jpeg/jpeg_ptr_double_free.c
+
+diff --git a/src/gd_gif_out.c b/src/gd_gif_out.c
+index 298a5812..d5a95346 100644
+--- a/src/gd_gif_out.c
++++ b/src/gd_gif_out.c
+@@ -99,6 +99,7 @@ static void char_init(GifCtx *ctx);
+ static void char_out(int c, GifCtx *ctx);
+ static void flush_char(GifCtx *ctx);
+ 
++static int _gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out);
+ 
+ 
+ 
+@@ -131,8 +132,11 @@ BGD_DECLARE(void *) gdImageGifPtr(gdImagePtr im, int *size)
+ 	void *rv;
+ 	gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
+ 	if (out == NULL) return NULL;
+-	gdImageGifCtx(im, out);
+-	rv = gdDPExtractData(out, size);
++	if (!_gdImageGifCtx(im, out)) {
++		rv = gdDPExtractData(out, size);
++	} else {
++		rv = NULL;
++	}
+ 	out->gd_free(out);
+ 	return rv;
+ }
+@@ -220,6 +224,12 @@ BGD_DECLARE(void) gdImageGif(gdImagePtr im, FILE *outFile)
+ 
+ */
+ BGD_DECLARE(void) gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
++{
++	_gdImageGifCtx(im, out);
++}
++
++/* returns 0 on success, 1 on failure */
++static int _gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
+ {
+ 	gdImagePtr pim = 0, tim = im;
+ 	int interlace, BitsPerPixel;
+@@ -231,7 +241,7 @@ BGD_DECLARE(void) gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
+ 		based temporary image. */
+ 		pim = gdImageCreatePaletteFromTrueColor(im, 1, 256);
+ 		if(!pim) {
+-			return;
++			return 1;
+ 		}
+ 		tim = pim;
+ 	}
+@@ -247,6 +257,8 @@ BGD_DECLARE(void) gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
+ 		/* Destroy palette based temporary image. */
+ 		gdImageDestroy(	pim);
+ 	}
++
++	return 0;
+ }
+ 
+ 
+diff --git a/src/gd_jpeg.c b/src/gd_jpeg.c
+index fc058420..96ef4302 100644
+--- a/src/gd_jpeg.c
++++ b/src/gd_jpeg.c
+@@ -117,6 +117,8 @@ static void fatal_jpeg_error(j_common_ptr cinfo)
+ 	exit(99);
+ }
+ 
++static int _gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality);
++
+ /*
+  * Write IM to OUTFILE as a JFIF-formatted JPEG image, using quality
+  * QUALITY.  If QUALITY is in the range 0-100, increasing values
+@@ -231,8 +233,11 @@ BGD_DECLARE(void *) gdImageJpegPtr(gdImagePtr im, int *size, int quality)
+ 	void *rv;
+ 	gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
+ 	if (out == NULL) return NULL;
+-	gdImageJpegCtx(im, out, quality);
+-	rv = gdDPExtractData(out, size);
++	if (!_gdImageJpegCtx(im, out, quality)) {
++		rv = gdDPExtractData(out, size);
++	} else {
++		rv = NULL;
++	}
+ 	out->gd_free(out);
+ 	return rv;
+ }
+@@ -253,6 +258,12 @@ void jpeg_gdIOCtx_dest(j_compress_ptr cinfo, gdIOCtx *outfile);
+ 
+ */
+ BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality)
++{
++	_gdImageJpegCtx(im, outfile, quality);
++}
++
++/* returns 0 on success, 1 on failure */
++static int _gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality)
+ {
+ 	struct jpeg_compress_struct cinfo;
+ 	struct jpeg_error_mgr jerr;
+@@ -287,7 +298,7 @@ BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality)
+ 		if(row) {
+ 			gdFree(row);
+ 		}
+-		return;
++		return 1;
+ 	}
+ 
+ 	cinfo.err->emit_message = jpeg_emit_message;
+@@ -328,7 +339,7 @@ BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality)
+ 	if(row == 0) {
+ 		gd_error("gd-jpeg: error: unable to allocate JPEG row structure: gdCalloc returns NULL\n");
+ 		jpeg_destroy_compress(&cinfo);
+-		return;
++		return 1;
+ 	}
+ 
+ 	rowptr[0] = row;
+@@ -405,6 +416,7 @@ BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality)
+ 	jpeg_finish_compress(&cinfo);
+ 	jpeg_destroy_compress(&cinfo);
+ 	gdFree(row);
++	return 0;
+ }
+ 
+ 
+diff --git a/src/gd_wbmp.c b/src/gd_wbmp.c
+index f19a1c96..a49bdbec 100644
+--- a/src/gd_wbmp.c
++++ b/src/gd_wbmp.c
+@@ -88,6 +88,8 @@ int gd_getin(void *in)
+ 	return (gdGetC((gdIOCtx *)in));
+ }
+ 
++static int _gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out);
++
+ /*
+ 	Function: gdImageWBMPCtx
+ 
+@@ -100,6 +102,12 @@ int gd_getin(void *in)
+ 		out   - the stream where to write
+ */
+ BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out)
++{
++	_gdImageWBMPCtx(image, fg, out);
++}
++
++/* returns 0 on success, 1 on failure */
++static int _gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out)
+ {
+ 	int x, y, pos;
+ 	Wbmp *wbmp;
+@@ -107,7 +115,7 @@ BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out)
+ 	/* create the WBMP */
+ 	if((wbmp = createwbmp(gdImageSX(image), gdImageSY(image), WBMP_WHITE)) == NULL) {
+ 		gd_error("Could not create WBMP\n");
+-		return;
++		return 1;
+ 	}
+ 
+ 	/* fill up the WBMP structure */
+@@ -123,11 +131,15 @@ BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out)
+ 
+ 	/* write the WBMP to a gd file descriptor */
+ 	if(writewbmp(wbmp, &gd_putout, out)) {
++		freewbmp(wbmp);
+ 		gd_error("Could not save WBMP\n");
++		return 1;
+ 	}
+ 
+ 	/* des submitted this bugfix: gdFree the memory. */
+ 	freewbmp(wbmp);
++
++	return 0;
+ }
+ 
+ /*
+@@ -271,8 +283,11 @@ BGD_DECLARE(void *) gdImageWBMPPtr(gdImagePtr im, int *size, int fg)
+ 	void *rv;
+ 	gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
+ 	if (out == NULL) return NULL;
+-	gdImageWBMPCtx(im, fg, out);
+-	rv = gdDPExtractData(out, size);
++	if (!_gdImageWBMPCtx(im, fg, out)) {
++		rv = gdDPExtractData(out, size);
++	} else {
++		rv = NULL;
++	}
+ 	out->gd_free(out);
+ 	return rv;
+ }
+diff --git a/tests/jpeg/CMakeLists.txt b/tests/jpeg/CMakeLists.txt
+index 19964b0c..a8d8162f 100644
+--- a/tests/jpeg/CMakeLists.txt
++++ b/tests/jpeg/CMakeLists.txt
+@@ -2,6 +2,7 @@ IF(JPEG_FOUND)
+ LIST(APPEND TESTS_FILES
+ 	jpeg_empty_file
+ 	jpeg_im2im
++	jpeg_ptr_double_free
+ 	jpeg_null
+ )
+ 
+diff --git a/tests/jpeg/Makemodule.am b/tests/jpeg/Makemodule.am
+index 7e5d317b..b89e1695 100644
+--- a/tests/jpeg/Makemodule.am
++++ b/tests/jpeg/Makemodule.am
+@@ -2,7 +2,8 @@ if HAVE_LIBJPEG
+ libgd_test_programs += \
+ 	jpeg/jpeg_empty_file \
+ 	jpeg/jpeg_im2im \
+-	jpeg/jpeg_null
++	jpeg/jpeg_null \
++	jpeg/jpeg_ptr_double_free
+ 
+ if HAVE_LIBPNG
+ libgd_test_programs += \
+diff --git a/tests/jpeg/jpeg_ptr_double_free.c b/tests/jpeg/jpeg_ptr_double_free.c
+new file mode 100644
+index 00000000..df5a510b
+--- /dev/null
++++ b/tests/jpeg/jpeg_ptr_double_free.c
+@@ -0,0 +1,31 @@
++/**
++ * Test that failure to convert to JPEG returns NULL
++ *
++ * We are creating an image, set its width to zero, and pass this image to
++ * `gdImageJpegPtr()` which is supposed to fail, and as such should return NULL.
++ *
++ * See also <https://github.com/libgd/libgd/issues/381>
++ */
++
++
++#include "gd.h"
++#include "gdtest.h"
++
++
++int main()
++{
++    gdImagePtr src, dst;
++    int size;
++
++    src = gdImageCreateTrueColor(1, 10);
++    gdTestAssert(src != NULL);
++
++    src->sx = 0; /* this hack forces gdImageJpegPtr() to fail */
++
++    dst = gdImageJpegPtr(src, &size, 0);
++    gdTestAssert(dst == NULL);
++
++    gdImageDestroy(src);
++
++    return gdNumFailures();
++}

diff --git a/media-libs/gd/files/gd-2.2.5-ossfuzz5700.patch b/media-libs/gd/files/gd-2.2.5-ossfuzz5700.patch
new file mode 100644
index 00000000000..891c232115e
--- /dev/null
+++ b/media-libs/gd/files/gd-2.2.5-ossfuzz5700.patch
@@ -0,0 +1,103 @@
+From 9fa3abd2e61da18ed2b889704e4e252f0f5a95fe Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Fri, 26 Jan 2018 01:57:52 -0500
+Subject: [PATCH] gif: fix out-of-bounds read w/corrupted lzw data
+
+oss-fuzz pointed out:
+gd_gif_in.c:605:16: runtime error: index 5595 out of bounds for type 'int [4096]'
+
+Add some bounds checking on each code that we read from the file.
+---
+ src/gd_gif_in.c           |   8 ++++++++
+ tests/gif/CMakeLists.txt  |   3 ++-
+ tests/gif/Makemodule.am   |   2 ++
+ tests/gif/ossfuzz5700.c   |  13 +++++++++++++
+ tests/gif/ossfuzz5700.gif | Bin 0 -> 30 bytes
+ 6 files changed, 26 insertions(+), 1 deletion(-)
+ create mode 100644 tests/gif/ossfuzz5700.c
+
+diff --git a/src/gd_gif_in.c b/src/gd_gif_in.c
+index afc08bf7..daf26e79 100644
+--- a/src/gd_gif_in.c
++++ b/src/gd_gif_in.c
+@@ -601,6 +601,10 @@ LWZReadByte_(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, i
+ 				/* Bad compressed data stream */
+ 				return -1;
+ 			}
++			if(code >= (1 << MAX_LWZ_BITS)) {
++				/* Corrupted code */
++				return -1;
++			}
+ 
+ 			*sd->sp++ = sd->table[1][code];
+ 
+@@ -610,6 +614,10 @@ LWZReadByte_(gdIOCtx *fd, LZW_STATIC_DATA *sd, char flag, int input_code_size, i
+ 
+ 			code = sd->table[0][code];
+ 		}
++		if(code >= (1 << MAX_LWZ_BITS)) {
++			/* Corrupted code */
++			return -1;
++		}
+ 
+ 		*sd->sp++ = sd->firstcode = sd->table[1][code];
+ 
+diff --git a/tests/gif/CMakeLists.txt b/tests/gif/CMakeLists.txt
+index 7d40cddc..2b73749e 100644
+--- a/tests/gif/CMakeLists.txt
++++ b/tests/gif/CMakeLists.txt
+@@ -3,6 +3,8 @@ LIST(APPEND TESTS_FILES
+ 	bug00181
+ 	bug00227
+ 	gif_null
++	ossfuzz5700
++	uninitialized_memory_read
+ )
+ 
+ IF(PNG_FOUND)
+@@ -12,7 +14,6 @@ LIST(APPEND TESTS_FILES
+ 	bug00060
+ 	bug00066
+ 	gif_im2im
+-	uninitialized_memory_read
+ )
+ ENDIF(PNG_FOUND)
+ 
+diff --git a/tests/gif/Makemodule.am b/tests/gif/Makemodule.am
+index 0bdeab7e..3199438f 100644
+--- a/tests/gif/Makemodule.am
++++ b/tests/gif/Makemodule.am
+@@ -3,6 +3,7 @@ libgd_test_programs += \
+ 	gif/bug00181 \
+ 	gif/bug00227 \
+ 	gif/gif_null \
++	gif/ossfuzz5700 \
+ 	gif/uninitialized_memory_read
+ 
+ if HAVE_LIBPNG
+@@ -24,4 +25,5 @@ EXTRA_DIST += \
+ 	gif/bug00060.gif \
+ 	gif/bug00066.gif \
+ 	gif/bug00066_exp.png \
++	gif/ossfuzz5700.gif \
+ 	gif/unitialized_memory_read.gif
+diff --git a/tests/gif/ossfuzz5700.c b/tests/gif/ossfuzz5700.c
+new file mode 100644
+index 00000000..8fc9f88c
+--- /dev/null
++++ b/tests/gif/ossfuzz5700.c
+@@ -0,0 +1,13 @@
++#include <stdio.h>
++#include "gd.h"
++#include "gdtest.h"
++
++int main()
++{
++	gdImagePtr im;
++	FILE *fp = gdTestFileOpen("gif/ossfuzz5700.gif");
++	im = gdImageCreateFromGif(fp);
++	fclose(fp);
++	gdImageDestroy(im);
++	return 0;
++}
+

diff --git a/media-libs/gd/gd-2.2.5-r2.ebuild b/media-libs/gd/gd-2.2.5-r2.ebuild
new file mode 100644
index 00000000000..7686c2013da
--- /dev/null
+++ b/media-libs/gd/gd-2.2.5-r2.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+inherit autotools multilib-minimal
+
+DESCRIPTION="Graphics library for fast image creation"
+HOMEPAGE="https://libgd.org/ https://www.boutell.com/gd/"
+SRC_URI="https://github.com/libgd/libgd/releases/download/${P}/lib${P}.tar.xz
+	test? (
+		https://github.com/libgd/libgd/raw/e0cb1b76c305db68b251fe782faa12da5d357593/tests/gif/ossfuzz5700.gif -> lib$P-ossfuzz5700.dat
+		https://github.com/libgd/libgd/raw/e0cb1b76c305db68b251fe782faa12da5d357593/tests/gif/php_bug_75571.gif -> lib$P-php_bug_75571.dat
+	)"
+
+LICENSE="gd IJG HPND BSD"
+SLOT="2/3"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="fontconfig jpeg png static-libs test tiff truetype webp xpm zlib"
+
+# fontconfig has prefixed font paths, details see bug #518970
+REQUIRED_USE="prefix? ( fontconfig )"
+
+RDEPEND="fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] )
+	jpeg? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] )
+	png? ( >=media-libs/libpng-1.6.10:0=[${MULTILIB_USEDEP}] )
+	tiff? ( media-libs/tiff:0[${MULTILIB_USEDEP}] )
+	truetype? ( >=media-libs/freetype-2.5.0.1[${MULTILIB_USEDEP}] )
+	webp? ( media-libs/libwebp:=[${MULTILIB_USEDEP}] )
+	xpm? ( >=x11-libs/libXpm-3.5.10-r1[${MULTILIB_USEDEP}] >=x11-libs/libXt-1.1.4[${MULTILIB_USEDEP}] )
+	zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+	>=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
+
+S="${WORKDIR}/lib${P}"
+
+PATCHES=(
+	"${FILESDIR}/${P}-ossfuzz5700.patch"
+	"${FILESDIR}/${P}-CVE-2018-5711.patch"
+	"${FILESDIR}/${P}-CVE-2018-1000222.patch"
+	"${FILESDIR}/${P}-CVE-2019-6977.patch"
+	"${FILESDIR}/${P}-CVE-2019-6978.patch"
+)
+
+src_unpack() {
+	default
+
+	cp "${DISTDIR}"/lib${P}-ossfuzz5700.dat "${S}"/tests/gif/ossfuzz5700.gif || die
+	cp "${DISTDIR}"/lib${P}-php_bug_75571.dat "${S}"/tests/gif/php_bug_75571.gif || die
+}
+
+src_prepare() {
+	default
+
+	eautoreconf
+}
+
+multilib_src_configure() {
+	# we aren't actually {en,dis}abling X here ... the configure
+	# script uses it just to add explicit -I/-L paths which we
+	# don't care about on Gentoo systems.
+	local myeconfargs=(
+		--disable-werror
+		--without-x
+		--without-liq
+		$(use_enable static-libs static)
+		$(use_with fontconfig)
+		$(use_with png)
+		$(use_with tiff)
+		$(use_with truetype freetype)
+		$(use_with jpeg)
+		$(use_with webp)
+		$(use_with xpm)
+		$(use_with zlib)
+	)
+	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+}
+
+multilib_src_install_all() {
+	dodoc README.md
+	find "${D}" -name '*.la' -delete || die
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-04  0:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-12 11:18 [gentoo-commits] repo/gentoo:master commit in: media-libs/gd/, media-libs/gd/files/ Markus Meier
  -- strict thread matches above, loose matches on Subject: below --
2016-11-02 18:54 Markus Meier
2019-03-04  0:29 Thomas Deutschmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox