From bb46690f71a07eb5e99656e093751555b1bb0242 Mon Sep 17 00:00:00 2001 From: Samuli Suominen Date: Sun, 14 Apr 2013 09:28:28 +0000 Subject: Patch from upstream for correcting the length written to uncompressed iTXt chunks. This caused "export to .png" with comments in media-gfx/gimp to produce corrupted files as noticed by lu_zero and jlec. (Portage version: 2.2.0_alpha172/cvs/Linux x86_64, signed Manifest commit with key 4868F14D) --- media-libs/libpng/ChangeLog | 12 ++++- ...rrected-length-written-to-uncompressed-iT.patch | 47 +++++++++++++++++ ...xed-previous-bugfix-to-work-on-64-bit-pla.patch | 32 ++++++++++++ ...moved-extra-recently-inserted-line-from-p.patch | 25 +++++++++ media-libs/libpng/libpng-1.6.1-r1.ebuild | 59 ++++++++++++++++++++++ 5 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 media-libs/libpng/files/libpng-1.6.1-Corrected-length-written-to-uncompressed-iT.patch create mode 100644 media-libs/libpng/files/libpng-1.6.1-Fixed-previous-bugfix-to-work-on-64-bit-pla.patch create mode 100644 media-libs/libpng/files/libpng-1.6.1-Removed-extra-recently-inserted-line-from-p.patch create mode 100644 media-libs/libpng/libpng-1.6.1-r1.ebuild (limited to 'media-libs') diff --git a/media-libs/libpng/ChangeLog b/media-libs/libpng/ChangeLog index 70a46a1d2aac..41dd491e04e0 100644 --- a/media-libs/libpng/ChangeLog +++ b/media-libs/libpng/ChangeLog @@ -1,6 +1,16 @@ # ChangeLog for media-libs/libpng # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-libs/libpng/ChangeLog,v 1.393 2013/04/12 14:42:58 jer Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-libs/libpng/ChangeLog,v 1.394 2013/04/14 09:28:28 ssuominen Exp $ + +*libpng-1.6.1-r1 (14 Apr 2013) + + 14 Apr 2013; Samuli Suominen +libpng-1.6.1-r1.ebuild, + +files/libpng-1.6.1-Corrected-length-written-to-uncompressed-iT.patch, + +files/libpng-1.6.1-Fixed-previous-bugfix-to-work-on-64-bit-pla.patch, + +files/libpng-1.6.1-Removed-extra-recently-inserted-line-from-p.patch: + Patch from upstream for correcting the length written to uncompressed iTXt + chunks. This caused "export to .png" with comments in media-gfx/gimp to + produce corrupted files as noticed by lu_zero and jlec. 12 Apr 2013; Jeroen Roovers libpng-1.5.15.ebuild: Stable for HPPA (bug #462314). diff --git a/media-libs/libpng/files/libpng-1.6.1-Corrected-length-written-to-uncompressed-iT.patch b/media-libs/libpng/files/libpng-1.6.1-Corrected-length-written-to-uncompressed-iT.patch new file mode 100644 index 000000000000..37f9d50189e3 --- /dev/null +++ b/media-libs/libpng/files/libpng-1.6.1-Corrected-length-written-to-uncompressed-iT.patch @@ -0,0 +1,47 @@ +From 9bb775fc8cbde98fca150992efe227937b9278ff Mon Sep 17 00:00:00 2001 +From: Glenn Randers-Pehrson +Date: Sat, 13 Apr 2013 14:19:25 -0500 +Subject: [PATCH 1/5] [libpng16] Corrected length written to uncompressed iTXt + chunks (Samuli Suominen). + +--- + ANNOUNCE | 1 + + CHANGES | 1 + + pngwutil.c | 6 +++--- + 3 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/pngwutil.c b/pngwutil.c +index 8c49cfd..8f66937 100644 +--- a/pngwutil.c ++++ b/pngwutil.c +@@ -1,7 +1,7 @@ + + /* pngwutil.c - utilities to write a PNG file + * +- * Last changed in libpng 1.6.0 [February 14, 2013] ++ * Last changed in libpng 1.6.2 [(PENDING RELEASE)] + * Copyright (c) 1998-2013 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) +@@ -1738,16 +1738,16 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key, + { + if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK) + png_error(png_ptr, png_ptr->zstream.msg); ++ png_write_chunk_header(png_ptr, png_iTXt, comp.output_len + prefix_len); + } + + else + { + if (comp.input_len > PNG_UINT_31_MAX-prefix_len) + png_error(png_ptr, "iTXt: uncompressed text too long"); ++ png_write_chunk_header(png_ptr, png_iTXt, strlen(text) + prefix_len); + } + +- png_write_chunk_header(png_ptr, png_iTXt, comp.output_len + prefix_len); +- + png_write_chunk_data(png_ptr, new_key, key_len); + + png_write_chunk_data(png_ptr, (png_const_bytep)lang, lang_len); +-- +1.8.1.5 + diff --git a/media-libs/libpng/files/libpng-1.6.1-Fixed-previous-bugfix-to-work-on-64-bit-pla.patch b/media-libs/libpng/files/libpng-1.6.1-Fixed-previous-bugfix-to-work-on-64-bit-pla.patch new file mode 100644 index 000000000000..761b7f91f5fa --- /dev/null +++ b/media-libs/libpng/files/libpng-1.6.1-Fixed-previous-bugfix-to-work-on-64-bit-pla.patch @@ -0,0 +1,32 @@ +From 70eb0720a04aa71eec6e97b568c8dd129d92c331 Mon Sep 17 00:00:00 2001 +From: John Bowler +Date: Sat, 13 Apr 2013 16:52:09 -0500 +Subject: [PATCH 2/5] [libpng16] Fixed previous bugfix to work on 64-bit + platforms. + +--- + pngwutil.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/pngwutil.c b/pngwutil.c +index 8f66937..755ccef 100644 +--- a/pngwutil.c ++++ b/pngwutil.c +@@ -1745,9 +1745,13 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key, + { + if (comp.input_len > PNG_UINT_31_MAX-prefix_len) + png_error(png_ptr, "iTXt: uncompressed text too long"); +- png_write_chunk_header(png_ptr, png_iTXt, strlen(text) + prefix_len); ++ ++ /* So the string will fit in a chunk: */ ++ comp.output_len = (png_uint_32)/*SAFE*/comp.input_len; + } + ++ png_write_chunk_header(png_ptr, png_iTXt, comp.output_len + prefix_len); ++ + png_write_chunk_data(png_ptr, new_key, key_len); + + png_write_chunk_data(png_ptr, (png_const_bytep)lang, lang_len); +-- +1.8.1.5 + diff --git a/media-libs/libpng/files/libpng-1.6.1-Removed-extra-recently-inserted-line-from-p.patch b/media-libs/libpng/files/libpng-1.6.1-Removed-extra-recently-inserted-line-from-p.patch new file mode 100644 index 000000000000..199c1be7f444 --- /dev/null +++ b/media-libs/libpng/files/libpng-1.6.1-Removed-extra-recently-inserted-line-from-p.patch @@ -0,0 +1,25 @@ +From 5ec05b3d7cec24c73c68bad4608a4ce15da0423f Mon Sep 17 00:00:00 2001 +From: Glenn Randers-Pehrson +Date: Sat, 13 Apr 2013 20:01:09 -0500 +Subject: [PATCH 3/5] [libpng16] Removed extra recently-inserted line from + pngwutil.c + +--- + pngwutil.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/pngwutil.c b/pngwutil.c +index 755ccef..f481683 100644 +--- a/pngwutil.c ++++ b/pngwutil.c +@@ -1738,7 +1738,6 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key, + { + if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK) + png_error(png_ptr, png_ptr->zstream.msg); +- png_write_chunk_header(png_ptr, png_iTXt, comp.output_len + prefix_len); + } + + else +-- +1.8.1.5 + diff --git a/media-libs/libpng/libpng-1.6.1-r1.ebuild b/media-libs/libpng/libpng-1.6.1-r1.ebuild new file mode 100644 index 000000000000..0682fb1dcfe2 --- /dev/null +++ b/media-libs/libpng/libpng-1.6.1-r1.ebuild @@ -0,0 +1,59 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-libs/libpng/libpng-1.6.1-r1.ebuild,v 1.1 2013/04/14 09:28:28 ssuominen Exp $ + +EAPI=5 + +inherit eutils libtool multilib + +DESCRIPTION="Portable Network Graphics library" +HOMEPAGE="http://www.libpng.org/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz + apng? ( mirror://sourceforge/apng/${P}-apng.patch.gz )" + +LICENSE="libpng" +SLOT="0/16" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" +IUSE="apng neon static-libs" + +RDEPEND="sys-libs/zlib:=" +DEPEND="${RDEPEND} + app-arch/xz-utils" + +DOCS=( ANNOUNCE CHANGES libpng-manual.txt README TODO ) + +src_prepare() { + epatch \ + "${FILESDIR}"/${P}-Corrected-length-written-to-uncompressed-iT.patch \ + "${FILESDIR}"/${P}-Fixed-previous-bugfix-to-work-on-64-bit-pla.patch \ + "${FILESDIR}"/${P}-Removed-extra-recently-inserted-line-from-p.patch + + if use apng; then + epatch "${WORKDIR}"/${PN}-*-apng.patch + # Don't execute symbols check with apng patch wrt #378111 + sed -i -e '/^check/s:scripts/symbols.chk::' Makefile.in || die + fi + elibtoolize +} + +src_configure() { + econf \ + $(use_enable static-libs static) \ + --enable-arm-neon=$(usex neon on off) +} + +src_install() { + default + # Even prune_libtool --all fails to remove libpng.la dead symlink wrt #436996 + find "${ED}" -name '*.la' -exec rm -f {} + +} + +pkg_preinst() { + has_version ${CATEGORY}/${PN}:1.5 && return 0 + preserve_old_lib /usr/$(get_libdir)/libpng15$(get_libname 15) +} + +pkg_postinst() { + has_version ${CATEGORY}/${PN}:1.5 && return 0 + preserve_old_lib_notify /usr/$(get_libdir)/libpng15$(get_libname 15) +} -- cgit v1.2.3-65-gdbad