diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-01-12 06:16:53 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-01-12 06:16:53 +0000 |
commit | 9052afb001fb81e46a8c024da7e3415d941576db (patch) | |
tree | a70c50a6fa859651bae7689c93dbd201cf4b5b3d /sys-apps/gawk | |
parent | old (diff) | |
download | gentoo-2-9052afb001fb81e46a8c024da7e3415d941576db.tar.gz gentoo-2-9052afb001fb81e46a8c024da7e3415d941576db.tar.bz2 gentoo-2-9052afb001fb81e46a8c024da7e3415d941576db.zip |
Grab some patches from Fedora to fixup double free #135931 by Georgi Georgiev.
(Portage version: 2.1.2_rc4-r7)
Diffstat (limited to 'sys-apps/gawk')
-rw-r--r-- | sys-apps/gawk/ChangeLog | 11 | ||||
-rw-r--r-- | sys-apps/gawk/files/digest-gawk-3.1.5-r3 | 3 | ||||
-rw-r--r-- | sys-apps/gawk/files/gawk-3.1.5-freewstr.patch | 193 | ||||
-rw-r--r-- | sys-apps/gawk/files/gawk-3.1.5-wconcat.patch | 16 | ||||
-rw-r--r-- | sys-apps/gawk/gawk-3.1.5-r3.ebuild | 112 |
5 files changed, 333 insertions, 2 deletions
diff --git a/sys-apps/gawk/ChangeLog b/sys-apps/gawk/ChangeLog index 6c69e318c1d8..da87c1590752 100644 --- a/sys-apps/gawk/ChangeLog +++ b/sys-apps/gawk/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-apps/gawk -# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/gawk/ChangeLog,v 1.97 2006/11/05 09:13:06 grobian Exp $ +# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/gawk/ChangeLog,v 1.98 2007/01/12 06:16:53 vapier Exp $ + +*gawk-3.1.5-r3 (12 Jan 2007) + + 12 Jan 2007; Mike Frysinger <vapier@gentoo.org> + +files/gawk-3.1.5-freewstr.patch, +files/gawk-3.1.5-wconcat.patch, + +gawk-3.1.5-r3.ebuild: + Grab some patches from Fedora to fixup double free #135931 by Georgi Georgiev. 05 Nov 2006; Fabian Groffen <grobian@gentoo.org> gawk-3.1.5-r1.ebuild, gawk-3.1.5-r2.ebuild: diff --git a/sys-apps/gawk/files/digest-gawk-3.1.5-r3 b/sys-apps/gawk/files/digest-gawk-3.1.5-r3 new file mode 100644 index 000000000000..9ac602be41d5 --- /dev/null +++ b/sys-apps/gawk/files/digest-gawk-3.1.5-r3 @@ -0,0 +1,3 @@ +MD5 4760325489479cac17fe0114b8f62f30 gawk-3.1.5.tar.gz 2310919 +RMD160 8d875f4ea9e9ef5c932468cf43c691f6e082b197 gawk-3.1.5.tar.gz 2310919 +SHA256 463dcb9d0ca398b1d4f5a332f6cd9cec56441265fca616f2ea1b44d459e9f0f8 gawk-3.1.5.tar.gz 2310919 diff --git a/sys-apps/gawk/files/gawk-3.1.5-freewstr.patch b/sys-apps/gawk/files/gawk-3.1.5-freewstr.patch new file mode 100644 index 000000000000..c4d98bafa2f6 --- /dev/null +++ b/sys-apps/gawk/files/gawk-3.1.5-freewstr.patch @@ -0,0 +1,193 @@ +--- gawk-3.1.5/builtin.c.freewstr 2005-07-26 20:07:43.000000000 +0200 ++++ gawk-3.1.5/builtin.c 2007-01-08 13:29:45.000000000 +0100 +@@ -2089,9 +2089,9 @@ + } + + free(buf); +- if (wc_indices != NULL) +- free(wc_indices); + } ++ if (wc_indices != NULL) ++ free(wc_indices); + } else { /* match failed */ + rstart = 0; + rlength = -1; +@@ -2462,6 +2462,8 @@ + free(t->stptr); + t->stptr = buf; + t->stlen = textlen; ++ free_wstr(t); ++ t->flags &= ~(NUMCUR|NUMBER); + + free_temp(s); + if (matches > 0 && lhs) { +@@ -2471,7 +2473,6 @@ + } + if (after_assign != NULL) + (*after_assign)(); +- t->flags &= ~(NUMCUR|NUMBER); + } + if (mb_indices != NULL) + free(mb_indices); +--- gawk-3.1.5/awk.h.freewstr 2005-07-26 20:07:43.000000000 +0200 ++++ gawk-3.1.5/awk.h 2007-01-08 12:31:26.000000000 +0100 +@@ -1166,6 +1166,9 @@ + #define force_wstring(n) str2wstr(n, NULL) + extern const wchar_t *wstrstr P((const wchar_t *haystack, size_t hs_len, const wchar_t *needle, size_t needle_len)); + extern const wchar_t *wcasestrstr P((const wchar_t *haystack, size_t hs_len, const wchar_t *needle, size_t needle_len)); ++extern void free_wstr P((NODE *n)); ++#else ++#define free_wstr(NODE) /* empty */ + #endif + /* re.c */ + extern Regexp *make_regexp P((const char *s, size_t len, int ignorecase, int dfa)); +--- gawk-3.1.5/node.c.freewstr 2007-01-08 12:31:26.000000000 +0100 ++++ gawk-3.1.5/node.c 2007-01-08 12:41:48.000000000 +0100 +@@ -218,15 +218,7 @@ + no_malloc: + s->stref = 1; + s->flags |= STRCUR; +-#if defined MBS_SUPPORT +- if ((s->flags & WSTRCUR) != 0) { +- assert(s->wstptr != NULL); +- free(s->wstptr); +- s->wstptr = NULL; +- s->wstlen = 0; +- s->flags &= ~WSTRCUR; +- } +-#endif ++ free_wstr(s); + return s; + } + +@@ -289,8 +281,14 @@ + *r = *n; + r->flags &= ~(PERM|TEMP|FIELD); + r->flags |= MALLOC; +-#if defined MBS_SUPPORT ++#ifdef MBS_SUPPORT ++ /* ++ * DON'T call free_wstr(r) here! ++ * r->wstptr still points at n->wstptr's value, and we ++ * don't want to free it! ++ */ + r->wstptr = NULL; ++ r->wstlen = 0; + #endif /* defined MBS_SUPPORT */ + if (n->type == Node_val && (n->flags & STRCUR) != 0) { + r->stref = 1; +@@ -346,11 +344,7 @@ + r->stref = 1; + r->stptr = NULL; + r->stlen = 0; +-#if defined MBS_SUPPORT +- r->wstptr = NULL; +- r->wstlen = 0; +- r->flags &= ~WSTRCUR; +-#endif /* MBS_SUPPORT */ ++ free_wstr(r); + #endif /* GAWKDEBUG */ + return r; + } +@@ -365,10 +359,11 @@ + getnode(r); + r->type = Node_val; + r->flags = (STRING|STRCUR|MALLOC); +-#if defined MBS_SUPPORT ++#ifdef MBS_SUPPORT + r->wstptr = NULL; + r->wstlen = 0; +-#endif ++#endif /* defined MBS_SUPPORT */ ++ + if (flags & ALREADY_MALLOCED) + r->stptr = s; + else { +@@ -512,20 +507,13 @@ + return; + } + free(tmp->stptr); +-#if defined MBS_SUPPORT +- if (tmp->wstptr != NULL) { +- assert((tmp->flags & WSTRCUR) != 0); +- free(tmp->wstptr); +- } +- tmp->flags &= ~WSTRCUR; +- tmp->wstptr = NULL; +- tmp->wstlen = 0; +-#endif ++ free_wstr(tmp); + } + freenode(tmp); + return; + } + if ((tmp->flags & FIELD) != 0) { ++ free_wstr(tmp); + freenode(tmp); + return; + } +@@ -708,11 +696,8 @@ + fall through and recompute to fill in the array */ + } + +- if (n->wstptr != NULL) { +- free(n->wstptr); +- n->wstptr = NULL; +- n->wstlen = 0; +- } ++ if (n->wstptr != NULL) ++ free_wstr(n); + + /* + * After consideration and consultation, this +@@ -777,6 +762,20 @@ + return n; + } + ++/* free_wstr --- release the wide string part of a node */ ++ ++void ++free_wstr(NODE *n) ++{ ++ if ((n->flags & WSTRCUR) != 0) { ++ assert(n->wstptr != NULL); ++ free(n->wstptr); ++ n->wstptr = NULL; ++ n->wstlen = 0; ++ n->flags &= ~WSTRCUR; ++ } ++} ++ + #if 0 + static void + dump_wstr(FILE *fp, const wchar_t *str, size_t len) +@@ -839,11 +838,10 @@ + h = towlower(*start); + n = towlower(needle[j]); + if (h != n) +- goto out; ++ continue; + } + return haystack + i; + } +-out: ; + } + + return NULL; +--- gawk-3.1.5/eval.c.freewstr 2007-01-08 12:31:26.000000000 +0100 ++++ gawk-3.1.5/eval.c 2007-01-08 12:31:26.000000000 +0100 +@@ -1176,13 +1176,7 @@ + memcpy(l->stptr + l->stlen, r->stptr, r->stlen); + l->stlen += r->stlen; + l->stptr[l->stlen] = '\0'; +-#if defined MBS_SUPPORT +- if (r->wstptr != NULL) +- free(r->wstptr); +- r->wstptr = NULL; +- r->wstlen = 0; +- r->flags &= ~WSTRCUR; +-#endif /* MBS_SUPPORT */ ++ free_wstr(l); + } else { + char *nval; + size_t nlen = l->stlen + r->stlen + 2; diff --git a/sys-apps/gawk/files/gawk-3.1.5-wconcat.patch b/sys-apps/gawk/files/gawk-3.1.5-wconcat.patch new file mode 100644 index 000000000000..e082f2457518 --- /dev/null +++ b/sys-apps/gawk/files/gawk-3.1.5-wconcat.patch @@ -0,0 +1,16 @@ +--- gawk-3.1.5/eval.c.wconcat 2006-02-14 09:40:54.000000000 +0100 ++++ gawk-3.1.5/eval.c 2006-02-14 09:43:33.000000000 +0100 +@@ -1176,6 +1176,13 @@ + memcpy(l->stptr + l->stlen, r->stptr, r->stlen); + l->stlen += r->stlen; + l->stptr[l->stlen] = '\0'; ++#if defined MBS_SUPPORT ++ if (r->wstptr != NULL) ++ free(r->wstptr); ++ r->wstptr = NULL; ++ r->wstlen = 0; ++ r->flags &= ~WSTRCUR; ++#endif /* MBS_SUPPORT */ + } else { + char *nval; + size_t nlen = l->stlen + r->stlen + 2; diff --git a/sys-apps/gawk/gawk-3.1.5-r3.ebuild b/sys-apps/gawk/gawk-3.1.5-r3.ebuild new file mode 100644 index 000000000000..59964ef976ec --- /dev/null +++ b/sys-apps/gawk/gawk-3.1.5-r3.ebuild @@ -0,0 +1,112 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/gawk/gawk-3.1.5-r3.ebuild,v 1.1 2007/01/12 06:16:53 vapier Exp $ + +inherit eutils toolchain-funcs multilib + +DESCRIPTION="GNU awk pattern-matching language" +HOMEPAGE="http://www.gnu.org/software/gawk/gawk.html" +SRC_URI="mirror://gnu/gawk/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" +IUSE="nls" + +RDEPEND="" +DEPEND="${RDEPEND} + nls? ( sys-devel/gettext )" + +SFFS=${WORKDIR}/filefuncs + +src_unpack() { + unpack ${P}.tar.gz + + # Copy filefuncs module's source over ... + cp -r "${FILESDIR}"/filefuncs "${SFFS}" || die "cp failed" + + cd "${S}" + epatch "${FILESDIR}"/${P}-core.patch + epatch "${FILESDIR}"/${P}-gcc4.patch + epatch "${FILESDIR}"/${P}-autotools-crap.patch #139397 + # Patches from Fedora + epatch "${FILESDIR}"/${PN}-3.1.3-getpgrp_void.patch + epatch "${FILESDIR}"/${P}-fieldwidths.patch #127163 + epatch "${FILESDIR}"/${P}-binmode.patch + epatch "${FILESDIR}"/${P}-num2str.patch + epatch "${FILESDIR}"/${P}-internal.patch + epatch "${FILESDIR}"/${P}-numflags.patch + epatch "${FILESDIR}"/${P}-syntaxerror.patch + epatch "${FILESDIR}"/${P}-wconcat.patch + epatch "${FILESDIR}"/${P}-freewstr.patch #135931 +} + +src_compile() { + econf \ + --bindir=/bin \ + --libexec='$(libdir)/misc' \ + $(use_enable nls) \ + --enable-switch \ + || die + emake || die "emake failed" + + cd "${SFFS}" + emake CC=$(tc-getCC) || die "filefuncs emake failed" +} + +src_install() { + make install DESTDIR="${D}" || die "install failed" + cd "${SFFS}" + make LIBDIR="$(get_libdir)" install || die "filefuncs install failed" + + dodir /usr/bin + # In some rare cases, (p)gawk gets installed as (p)gawk- and not + # (p)gawk-${PV} ... Also make sure that /bin/(p)gawk is a symlink + # to /bin/(p)gawk-${PV}. + local binpath x + for x in gawk pgawk igawk ; do + [[ ${x} == "gawk" ]] \ + && binpath="/bin" \ + || binpath="/usr/bin" + + if [[ -f ${D}/bin/${x} && ! -f ${D}/bin/${x}-${PV} ]] ; then + mv -f "${D}"/bin/${x} "${D}"/${binpath}/${x}-${PV} + elif [[ -f ${D}/bin/${x}- && ! -f ${D}/bin/${x}-${PV} ]] ; then + mv -f "${D}"/bin/${x}- "${D}"/${binpath}/${x}-${PV} + elif [[ ${binpath} == "/usr/bin" && -f ${D}/bin/${x}-${PV} ]] ; then + mv -f "${D}"/bin/${x}-${PV} "${D}"/${binpath}/${x}-${PV} + fi + + rm -f "${D}"/bin/${x} + dosym ${x}-${PV} ${binpath}/${x} + [[ ${binpath} == "/usr/bin" ]] && dosym /usr/bin/${x}-${PV} /bin/${x} + done + + rm -f "${D}"/bin/awk + dodir /usr/bin + # Compat symlinks + dosym /bin/gawk-${PV} /usr/bin/gawk + dosym gawk-${PV} /bin/awk + dosym /bin/gawk-${PV} /usr/bin/awk + [[ ${USERLAND} != "GNU" ]] && rm -f "${D}"/{,usr/}bin/awk{,-${PV}} + + # Install headers + insinto /usr/include/awk + doins "${S}"/*.h || die "ins headers failed" + # We do not want 'acconfig.h' in there ... + rm -f "${D}"/usr/include/awk/acconfig.h + + cd "${S}" + rm -f "${D}"/usr/share/man/man1/pgawk.1 + dosym gawk.1.gz /usr/share/man/man1/pgawk.1.gz + [[ ${USERLAND} == "GNU" ]] && dosym gawk.1.gz /usr/share/man/man1/awk.1.gz + dodoc AUTHORS ChangeLog FUTURES LIMITATIONS NEWS PROBLEMS POSIX.STD README + docinto README_d + dodoc README_d/* + docinto awklib + dodoc awklib/ChangeLog + docinto pc + dodoc pc/ChangeLog + docinto posix + dodoc posix/ChangeLog +} |