diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-10-14 18:34:55 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-10-14 18:34:55 +0000 |
commit | b16c6d6d23038b47fd66025f24698d36ab3f270c (patch) | |
tree | b529f9b5275c90281831e8602ec02410e9a45e9e /sys-apps/sed | |
parent | old (diff) | |
download | gentoo-2-b16c6d6d23038b47fd66025f24698d36ab3f270c.tar.gz gentoo-2-b16c6d6d23038b47fd66025f24698d36ab3f270c.tar.bz2 gentoo-2-b16c6d6d23038b47fd66025f24698d36ab3f270c.zip |
Add fix from upstream for infinite hangs on invalid multibyte sequences #284403 by Zer4tul.
(Portage version: 2.2_rc96/cvs/Linux x86_64)
Diffstat (limited to 'sys-apps/sed')
-rw-r--r-- | sys-apps/sed/ChangeLog | 10 | ||||
-rw-r--r-- | sys-apps/sed/files/sed-4.2.1-handle-incomplete-sequences-as-if-they-were-invalid.patch | 45 | ||||
-rw-r--r-- | sys-apps/sed/sed-4.2.1-r1.ebuild | 69 |
3 files changed, 123 insertions, 1 deletions
diff --git a/sys-apps/sed/ChangeLog b/sys-apps/sed/ChangeLog index e2271e04f5df..3c16314e5502 100644 --- a/sys-apps/sed/ChangeLog +++ b/sys-apps/sed/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for sys-apps/sed # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/sed/ChangeLog,v 1.104 2010/10/14 15:23:56 fauli Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/sed/ChangeLog,v 1.105 2010/10/14 18:34:55 vapier Exp $ + +*sed-4.2.1-r1 (14 Oct 2010) + + 14 Oct 2010; Mike Frysinger <vapier@gentoo.org> +sed-4.2.1-r1.ebuild, + +files/sed-4.2.1-handle-incomplete-sequences-as-if-they-were-invalid.patch + : + Add fix from upstream for infinite hangs on invalid multibyte sequences + #284403 by Zer4tul. 14 Oct 2010; Christian Faulhammer <fauli@gentoo.org> sed-4.2.1.ebuild: stable x86, bug 340919 diff --git a/sys-apps/sed/files/sed-4.2.1-handle-incomplete-sequences-as-if-they-were-invalid.patch b/sys-apps/sed/files/sed-4.2.1-handle-incomplete-sequences-as-if-they-were-invalid.patch new file mode 100644 index 000000000000..dfd9206d3bf4 --- /dev/null +++ b/sys-apps/sed/files/sed-4.2.1-handle-incomplete-sequences-as-if-they-were-invalid.patch @@ -0,0 +1,45 @@ +http://bugs.gentoo.org/284403 + +From 20f68fb1abe862a98bc0378e5bb54d94bb98b8fe Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini <bonzini@gnu.org> +Date: Thu, 15 Oct 2009 19:56:12 +0200 +Subject: [PATCH] handle incomplete sequences as if they were invalid + +2009-10-15 Paolo Bonzini <bonzini@gnu.org> + WANG Yunfeng <uhuruh@gmail.com> + + * sed/execute.c (str_append, str_append_modified): Handle incomplete + sequences as if they were invalid. +--- + ChangeLog | 6 ++++++ + NEWS | 4 +++- + sed/execute.c | 6 +++--- + 3 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/sed/execute.c b/sed/execute.c +index 66cb809..d5903be 100644 +--- a/sed/execute.c ++++ b/sed/execute.c +@@ -254,8 +254,8 @@ str_append(to, string, length) + { + size_t n = MBRLEN (string, length, &to->mbstate); + +- /* An invalid sequence is treated like a singlebyte character. */ +- if (n == (size_t) -1) ++ /* An invalid or imcomplete sequence is treated like a singlebyte character. */ ++ if (n == (size_t) -1 || n == (size_t) -2) + { + memset (&to->mbstate, 0, sizeof (to->mbstate)); + n = 1; +@@ -341,7 +341,7 @@ str_append_modified(to, string, length, type) + /* Copy the new wide character to the end of the string. */ + n = WCRTOMB (to->active + to->length, wc, &to->mbstate); + to->length += n; +- if (n == -1) ++ if (n == -1 || n == -2) + { + fprintf (stderr, "Case conversion produced an invalid character!"); + abort (); +-- +1.7.3.1 + diff --git a/sys-apps/sed/sed-4.2.1-r1.ebuild b/sys-apps/sed/sed-4.2.1-r1.ebuild new file mode 100644 index 000000000000..1db2d9ce21c9 --- /dev/null +++ b/sys-apps/sed/sed-4.2.1-r1.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/sed/sed-4.2.1-r1.ebuild,v 1.1 2010/10/14 18:34:55 vapier Exp $ + +inherit eutils flag-o-matic toolchain-funcs + +DESCRIPTION="Super-useful stream editor" +HOMEPAGE="http://sed.sourceforge.net/" +SRC_URI="mirror://gnu/sed/${P}.tar.bz2" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" +IUSE="acl nls selinux static" + +RDEPEND="nls? ( virtual/libintl ) + acl? ( virtual/acl )" +DEPEND="${RDEPEND} + nls? ( sys-devel/gettext )" + +src_bootstrap_sed() { + # make sure system-sed works #40786 + export NO_SYS_SED="" + if ! type -p sed > /dev/null ; then + NO_SYS_SED="!!!" + ./bootstrap.sh || die "couldnt bootstrap" + cp sed/sed "${T}"/ || die "couldnt copy" + export PATH="${PATH}:${T}" + make clean || die "couldnt clean" + fi +} + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/${PN}-4.1.5-alloca.patch + epatch "${FILESDIR}"/${P}-handle-incomplete-sequences-as-if-they-were-invalid.patch #284403 + # don't use sed here if we have to recover a broken host sed +} + +src_compile() { + src_bootstrap_sed + # this has to be after the bootstrap portion + sed -i \ + -e '/docdir =/s:=.*/doc:= $(datadir)/doc/'${PF}'/html:' \ + doc/Makefile.in || die "sed html doc" + + local myconf= bindir=/bin + if ! use userland_GNU ; then + myconf="--program-prefix=g" + bindir=/usr/bin + fi + + use selinux || export ac_cv_{search_setfilecon,header_selinux_{context,selinux}_h}=no + use static && append-ldflags -static + econf \ + --bindir=${bindir} \ + $(use_enable acl) \ + $(use_enable nls) \ + ${myconf} + emake || die "build failed" +} + +src_install() { + emake install DESTDIR="${D}" || die "Install failed" + dodoc NEWS README* THANKS AUTHORS BUGS ChangeLog + docinto examples + dodoc "${FILESDIR}"/{dos2unix,unix2dos} +} |