Add a NULL-ptr check fix by Mihai Limbasan #75305.
authorMike Frysinger <vapier@gentoo.org>
Sun, 26 Dec 2004 21:48:30 +0000 (21:48 +0000)
committerMike Frysinger <vapier@gentoo.org>
Sun, 26 Dec 2004 21:48:30 +0000 (21:48 +0000)
app-arch/bzip2/ChangeLog
app-arch/bzip2/Manifest
app-arch/bzip2/bzip2-1.0.2-r4.ebuild [new file with mode: 0644]
app-arch/bzip2/files/1.0.2-NULL-ptr-check.patch [new file with mode: 0644]
app-arch/bzip2/files/1.0.2-makefile-CFLAGS.patch [new file with mode: 0644]
app-arch/bzip2/files/digest-bzip2-1.0.2-r4 [new file with mode: 0644]

index 98a70d64d97d84cd94e320d90bff63edc6c4d4a7..91c2676feef54d13c1384cea84fcab04216b8b48 100644 (file)
@@ -1,6 +1,13 @@
 # ChangeLog for app-arch/bzip2
 # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-arch/bzip2/ChangeLog,v 1.12 2004/08/15 07:00:16 lv Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-arch/bzip2/ChangeLog,v 1.13 2004/12/26 21:48:30 vapier Exp $
+
+*bzip2-1.0.2-r4 (26 Dec 2004)
+
+  26 Dec 2004; Mike Frysinger <vapier@gentoo.org>
+  +files/1.0.2-NULL-ptr-check.patch, +files/1.0.2-makefile-CFLAGS.patch,
+  +bzip2-1.0.2-r4.ebuild:
+  Add a NULL-ptr check fix by Mihai Limbasan #75305.
 
   14 Aug 2004; Travis Tilley <lv@gentoo.org> bzip2-1.0.2-r3.ebuild:
   added CONF_LIBDIR support for installing libbz2 to lib64/lib32
index 051b792a7267a5b567b16551887f49249e3a63e1..30cb1e04565b2dafba0e5bd50701cbb5af4cb592 100644 (file)
@@ -1,14 +1,18 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-MD5 9e751367e338078a681cd6f7c722d93b ChangeLog 4441
+MD5 db4ef7c97ec2199ba93060ee5b6e92d1 ChangeLog 4679
 MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164
+MD5 0fdee407cf5685474fbbf93aa2697679 bzip2-1.0.2-r4.ebuild 2099
 MD5 6f271e15b873b0ebc1056c2cdbe5a161 bzip2-1.0.2-r3.ebuild 2386
+MD5 382f154f0ba01de10aff6207652d6799 files/digest-bzip2-1.0.2-r4 63
+MD5 cc73bebefba3a38c58fc49b49d7d25a7 files/1.0.2-NULL-ptr-check.patch 838
+MD5 378e8d34dd95cc65b7f65565df5d85f7 files/1.0.2-makefile-CFLAGS.patch 841
 MD5 382f154f0ba01de10aff6207652d6799 files/digest-bzip2-1.0.2-r3 63
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.9.10 (GNU/Linux)
 
-iD8DBQFBtk4YroRuSHgZdywRAtkfAJ9iGIC1l8PJjciTGaOL6gghrPuyHQCfY4t1
-fTFx5V60oVcjVTIcSd/86eQ=
-=jLUr
+iD8DBQFBzzHBroRuSHgZdywRArjAAJ0b7bdISk0TVPnjzWR2Ze16eywn6gCfYW6T
+JyrDZWk11L8K0SCoVwMPnRs=
+=iqKU
 -----END PGP SIGNATURE-----
diff --git a/app-arch/bzip2/bzip2-1.0.2-r4.ebuild b/app-arch/bzip2/bzip2-1.0.2-r4.ebuild
new file mode 100644 (file)
index 0000000..70f3b7e
--- /dev/null
@@ -0,0 +1,78 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-arch/bzip2/bzip2-1.0.2-r4.ebuild,v 1.1 2004/12/26 21:48:30 vapier Exp $
+
+inherit toolchain-funcs flag-o-matic
+
+DESCRIPTION="A high-quality data compressor used extensively by Gentoo Linux"
+HOMEPAGE="http://sources.redhat.com/bzip2/"
+SRC_URI="ftp://sources.redhat.com/pub/bzip2/v102/${P}.tar.gz"
+
+LICENSE="BZIP2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="build static"
+
+DEPEND="virtual/libc"
+
+src_unpack() {
+       unpack ${A}
+       cd ${S}
+       epatch ${FILESDIR}/${PV}-NULL-ptr-check.patch
+       epatch ${FILESDIR}/${PV}-makefile-CFLAGS.patch
+       sed -i -e 's:\$(PREFIX)/man:\$(PREFIX)/share/man:g' Makefile || die
+
+       use static && append-flags -static
+
+       # bzip2 will to run itself after it has built itself which we
+       # can't do if we are cross compiling. -solar
+       if [[ -x /bin/bzip2 ]] && [[ ${CTARGET} != ${CHOST} ]] ; then
+               sed -i -e 's:./bzip2 -:bzip2 -:g' Makefile || die
+       fi
+}
+
+src_compile() {
+       local makeopts="
+               CC=$(tc-getCC)
+               AR=$(tc-getAR)
+               RANLIB=$(tc-getRANLIB)
+       "
+       if ! use build ; then
+               emake ${makeopts} -f Makefile-libbz2_so all || die "Make failed libbz2"
+       fi
+       emake ${makeopts} all || die "Make failed"
+}
+
+src_install() {
+       if ! use build ; then
+               make PREFIX="${D}"/usr install || die
+               mv "${D}"/usr/bin "${D}"
+
+               # These are symlinks to bzip2 ...
+               for x in bunzip2 bzcat ; do
+                       if [[ -f ${D}/bin/${x} ]] ; then
+                               rm -f ${D}/bin/${x}
+                               dosym bzip2 /bin/${x}
+                       fi
+               done
+
+               [[ -z ${CONF_LIBDIR} ]] && CONF_LIBDIR="lib"
+               [[ ${CONF_LIBDIR} != "lib" ]] && mv ${D}/usr/lib ${D}/usr/${CONF_LIBDIR}
+               dolib.so ${S}/libbz2.so.${PV}
+               dosym libbz2.so.${PV} /usr/${CONF_LIBDIR}/libbz2.so.1.0
+               dosym libbz2.so.${PV} /usr/${CONF_LIBDIR}/libbz2.so
+               dosym libbz2.so.${PV} /usr/${CONF_LIBDIR}/libbz2.so.1
+
+               dodoc README CHANGES Y2K_INFO
+               docinto txt
+               dodoc *.txt
+               docinto ps
+               dodoc *.ps
+               dohtml manual_*.html
+       else
+               into /
+               dobin bzip2
+               dosym bzip2 /bin/bzcat
+               dosym bzip2 /bin/bunzip2
+       fi
+}
diff --git a/app-arch/bzip2/files/1.0.2-NULL-ptr-check.patch b/app-arch/bzip2/files/1.0.2-NULL-ptr-check.patch
new file mode 100644 (file)
index 0000000..e35080f
--- /dev/null
@@ -0,0 +1,27 @@
+Mihai Limbasan writes:
+BZ2_bzclose fails to perform a NULL pointer check before actually
+using the passed BZFILE * argument. The NULL check *is* performed but
+only after the argument is used for the first time, resulting in a
+potential NULL pointer dereference.
+
+http://bugs.gentoo.org/show_bug.cgi?id=75305
+
+Sent upstream but no feedback thus far :(
+diff -Naur bzip2-1.0.2-orig/bzlib.c bzip2-1.0.2/bzlib.c
+--- bzip2-1.0.2-orig/bzlib.c   2002-01-05 02:48:41.000000000 +0200
++++ bzip2-1.0.2/bzlib.c        2004-12-22 15:12:52.824593032 +0200
+@@ -1536,9 +1536,12 @@
+ void BZ_API(BZ2_bzclose) (BZFILE* b)
+ {
+    int bzerr;
+-   FILE *fp = ((bzFile *)b)->handle;
+-   
++   FILE *fp;
++
+    if (b==NULL) {return;}
++
++   fp = ((bzFile *)b)->handle;
++
+    if(((bzFile*)b)->writing){
+       BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL);
+       if(bzerr != BZ_OK){
diff --git a/app-arch/bzip2/files/1.0.2-makefile-CFLAGS.patch b/app-arch/bzip2/files/1.0.2-makefile-CFLAGS.patch
new file mode 100644 (file)
index 0000000..bf7d430
--- /dev/null
@@ -0,0 +1,22 @@
+--- Makefile.orig      2004-12-26 16:30:06.354116536 -0500
++++ Makefile   2004-12-26 16:32:13.617769520 -0500
+@@ -9,7 +9,7 @@
+ 
+ # Suitably paranoid flags to avoid bugs in gcc-2.7
+ BIGFILES=-D_FILE_OFFSET_BITS=64
+-CFLAGS=-Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce $(BIGFILES)
++CFLAGS+=-Wall -Winline -fno-strength-reduce $(BIGFILES)
+ 
+ # Where you want it installed when you do 'make install'
+ PREFIX=/usr
+--- Makefile-libbz2_so.orig    2004-12-26 16:32:23.972195408 -0500
++++ Makefile-libbz2_so 2004-12-26 16:32:34.835543928 -0500
+@@ -9,7 +9,7 @@
+ SHELL=/bin/sh
+ CC=gcc
+ BIGFILES=-D_FILE_OFFSET_BITS=64
+-CFLAGS=-fpic -fPIC -Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce $(BIGFILES)
++CFLAGS+=-fpic -fPIC -Wall -Winline -fomit-frame-pointer -fno-strength-reduce $(BIGFILES)
+ 
+ OBJS= blocksort.o  \
+       huffman.o    \
diff --git a/app-arch/bzip2/files/digest-bzip2-1.0.2-r4 b/app-arch/bzip2/files/digest-bzip2-1.0.2-r4
new file mode 100644 (file)
index 0000000..5b1f375
--- /dev/null
@@ -0,0 +1 @@
+MD5 ee76864958d568677f03db8afad92beb bzip2-1.0.2.tar.gz 665198