commit:     e1eddb2f7a28b1ee7d11399b7616cb033226b7c8
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  5 15:17:58 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Dec  5 15:17:58 2015 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=e1eddb2f

sys-apps/busybox: bump to 1.24.1, bug #567506.

Package-Manager: portage-2.2.20.1
RepoMan-Options: --force

 sys-apps/busybox/Manifest                         |   3 +
 sys-apps/busybox/busybox-1.24.1-r99.ebuild        | 310 ++++++++++++++++++++++
 sys-apps/busybox/files/busybox-1.24.1-unzip.patch | 112 ++++++++
 3 files changed, 425 insertions(+)

diff --git a/sys-apps/busybox/Manifest b/sys-apps/busybox/Manifest
index 43bbecd..4e7d4d8 100644
--- a/sys-apps/busybox/Manifest
+++ b/sys-apps/busybox/Manifest
@@ -1,5 +1,6 @@
 AUX busybox-1.19.0-bb.patch 908 SHA256 
98f92c2edbcf61d1bacef783ea8b08cce07051b0a4489ed3f4579296846f89f1 SHA512 
d4024e531ce7113cf554646608b1ef356e51691e3e21d165621b3690c82b56a319867b90d9daba548b635d9dbd41be5efea63181b7123d4505e529d863a8214c
 WHIRLPOOL 
b0d6d9b08ad0930e5243c7addc8a6db61505e95ed8e72c64fbfd734cb6ff9e303b3eb8ea6ec4790b2be567783664230cf278eb3e673fa0844c3881cf993f7cb8
 AUX busybox-1.23.1-trylink-flags.patch 1334 SHA256 
9791303d0ec22b8c97223758987c0c4fa562ace05a56be4c17837c9f1e1ce490 SHA512 
5ca429047719943cde0493790c9212f1386ac1ebeb65a15b0497ac49821cac36c60f78aa9f35551af28ab21465ef4118782260636968393f19ecd27c44a6a046
 WHIRLPOOL 
0fb2d02660c100ab1defc03da3292a9ec055697553aeb62094f1ae933edd99fe105ba2687910197dd253b7b970673973003707479f7a4865168d39f679b12f61
+AUX busybox-1.24.1-unzip.patch 3903 SHA256 
423e7b2c9dc5614de8038e3938de6f6831e79bbd1889a9a80bef1780a2635ce8 SHA512 
c6b33f1b3e8c995a8b47f6c66f068db4068a53293a6d321adb184ce2ffebff4a94c64814d80bfdf5ce103176ed6c892d4d9641f72831833672d87cefed97c472
 WHIRLPOOL 
8b356fb1a38697da657c0f2e47b726bc738a13d104c4169f8195646a7890f42d47fd0f217ad9943e4432b27d1fc6adad334f9ac4780f3a5ba48b6da977503c0c
 AUX ginit.c 3097 SHA256 
fd6a4715d3dd10f6db479020433da3997d397658301335c847fb779129238b8c SHA512 
8bf70f13db0fbeecedf9a9f862c5391c0d8b7aa3ddd2ec85cda9b360c3117a01e32b01017b8c30197f587e521ba360ff70d1caf8d0f69d5c3a27f37ecc252e7c
 WHIRLPOOL 
a1ec3ccc296033d88a9504b693c7d249d0bd11b1d75e3f59a62137c5e4b4c914fe2b8971c86dbca2cc8ccc0d86f3f8c2c45bb44cec85a3628c44f091476baa92
 AUX klogd.confd 218 SHA256 
737b78745964e110da2fd3357c6d5fb80ccacf979039b8d40c03cf1cb969e5f3 SHA512 
3348d5376b368b28d1431692a93868cd4550be12ad729340c5f78da35a5bd295e7613d70ce8ccde5029ad6d87a41c2f24155180f3570de8a9174dd63dece143f
 WHIRLPOOL 
ea28c1d926e36fba0ab69de8ddfd2503889b7cfa3a4ada347a9d22d9894fe30be068c0ed55f899b952e62b8de3cb69e1a4209f7864787988ded28ede10c7445a
 AUX klogd.initd 359 SHA256 
ef607b72d270797e4be1fba425c23ba26078633c47c698063bd4b17e7b4ff8c3 SHA512 
e9d6215e4b0dcc4fbb507ce2bb84c818ad18951282c47c98b0c98b3fa58e6b28218f608689a7786cb0447673ae1f5c3ba5767f9b29cffd73325d93bf2a928ac9
 WHIRLPOOL 
d7e82a0d2a6a60b2444a3b212022250297ca163001045bf508442972fc6330c4eea55cb965920778e090c92a69441e864e6721f02ecc6d10279b6196b14f7e71
@@ -18,5 +19,7 @@ AUX syslogd.initd 383 SHA256 
b66e709317513b79139d5441c712839e271ff5177a3d743b86e
 AUX watchdog.confd 232 SHA256 
786d9497ad55c29d6fff231709e71ecad94f2ee1de3b45b461deb29c3eba1c63 SHA512 
8fd7121075535195f3e5d43ec773713c883fb7865cd5e5927b3b20c2605c50acb81d50461bd1a246c1282006ce74b11932ac1cec67ddc2be15da2f9aa8674232
 WHIRLPOOL 
8ea0f6b759198c978f10bf0b2b00cc73343e72401a05edf257b9c5e1032e8a619328aaa02936b5b5a717a021baa84b5653b8c9826e14e5c07c7b7af98f878767
 AUX watchdog.initd 334 SHA256 
ae335a9540d282277d0a127673efff279177a1bb643e98afd772eef9423fe79f SHA512 
e915a2b5567b1cfe5423b00ca984c37dea4afd72bc3b7a550858f7140dc18283831bb9cfeeb564ced2669706cf747f3934fd339f9e93d456b229b03781ac9303
 WHIRLPOOL 
c57eaf47d0501394f2f08a6b6f09529f91fd34f3d5027f6e159573ea8c5321a88c2cb01511971d15f8b25c9a44693c88e340ee35949c4cdab49d7fbbbe064c22
 DIST busybox-1.23.2.tar.bz2 2252786 SHA256 
05a6f9e21aad8c098e388ae77de7b2361941afa7157ef74216703395b14e319a SHA512 
209c8ef26e40ccb81510f6b663202b080f9bbecac7faf386bbabf7e36a43d63b15dd6ce9f7a84c1ccc5345c524999812251da1e113ef9faadc6af1fedd24c7c9
 WHIRLPOOL 
a0396f7f49ae702f1617e72d5d4646aceec4eba67219c7125bd8d0926d1acb1ef41ea15a7406c3cf5e5e0d8925cc75910ed5128e5fbdd257b80e2cb4f7a048a2
+DIST busybox-1.24.1.tar.bz2 2068803 SHA256 
37d03132cc078937360b392170b7a1d0e5b322eee9f57c0b82292a8b1f0afe3d SHA512 
3afc757ebaae61ae13c2c69097ee734717434f9e658eb77093a8b7b49af3326cbca2d723483ff84a1da99544b822fd2b47d9a97c68f09962e11754e5daf124ca
 WHIRLPOOL 
5e827d08d737caac832e7e5923da624094ff27ee2edbb46dadc339e95edba65378a8fa3db412682724476a2092eee41a804f8f36c2eec0b9f883f5ba855f3ad0
 EBUILD busybox-1.23.2-r99.ebuild 8889 SHA256 
395dec4ab6daeca4206d4b3ee45a901fbeee32a5c8faa516bb2abf98dc0b3e7d SHA512 
3853b2c04731a67a55275217b9eee79effde01352c4e261721dca8b7e31b5c594ad275524464291b5bdcbd306dc17c8f7167411beb310815da03c7cfdebb3fe0
 WHIRLPOOL 
26e7e3b94139010f74d95e68b1329c75c6716429ec6b5dc72e2c9ad82c8ab052d74b3db25e651e37138021c3fada808a5820f7a1a9ec6e3761c74fa26a056a02
+EBUILD busybox-1.24.1-r99.ebuild 8806 SHA256 
78cb413fffb1bf9b9da50ed3373672b07fea7ac40ced778e52710f0a1f365834 SHA512 
6d8b480c5dcc9c45cb0d3572799962eba8d024e94dbf97d593ff7e8cd17fa878fb729ed243bcd4382e75e80c911991f116c0ba987e1700651bfe4a09e1cc2434
 WHIRLPOOL 
6840d74b1150bb75209144e9062d52be49c9b46d8f5f45e69ce8996d3f2e867ae1eda9f4c470d7641bf4066c883b7589ae0414843aebd1ceca900fa2286e364c
 MISC metadata.xml 708 SHA256 
e17f2240f57d74f8847e7bbf4e3cf44fdcd3ab3f610e0a66eb186d2a598178be SHA512 
0d26c0593b156cc5764ad03c64e9b2a724b3877e348787d57818aec6b32f995951a9c0976a92d6ba824a2a5983d0c88116b9d335e51ba0e3c7b8f89e579482ba
 WHIRLPOOL 
2ab4758748cf6d83d1a3a1d2f5f9472825a01affe5c7fdf8cd78fb9c75a1abaf18d8895fce12c7c502453caf68dd40799f47cce502804c9ec60705af2bb4f388

diff --git a/sys-apps/busybox/busybox-1.24.1-r99.ebuild 
b/sys-apps/busybox/busybox-1.24.1-r99.ebuild
new file mode 100644
index 0000000..7cde8fa
--- /dev/null
+++ b/sys-apps/busybox/busybox-1.24.1-r99.ebuild
@@ -0,0 +1,310 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# See `man savedconfig.eclass` for info on how to use USE=savedconfig.
+
+EAPI="4"
+inherit eutils flag-o-matic savedconfig toolchain-funcs multilib
+
+DESCRIPTION="Utilities for rescue and embedded systems"
+HOMEPAGE="http://www.busybox.net/";
+if [[ ${PV} == "9999" ]] ; then
+       MY_P=${PN}
+       EGIT_REPO_URI="git://busybox.net/busybox.git"
+       inherit git-2
+else
+       MY_P=${PN}-${PV/_/-}
+       SRC_URI="http://www.busybox.net/downloads/${MY_P}.tar.bz2";
+       KEYWORDS="amd64 arm ~mips ppc x86"
+fi
+
+LICENSE="GPL-2" # GPL-2 only
+SLOT="0"
+IUSE="debug ipv6 livecd make-symlinks math mdev pam selinux sep-usr static 
syslog systemd"
+RESTRICT="test"
+
+COMMON_DEPEND="!static? ( selinux? ( sys-libs/libselinux ) )
+       pam? ( sys-libs/pam )"
+DEPEND="${COMMON_DEPEND}
+       static? ( selinux? ( sys-libs/libselinux[static-libs(+)] ) )
+       >=sys-kernel/linux-headers-2.6.39"
+RDEPEND="${COMMON_DEPEND}
+       mdev? ( !<sys-apps/openrc-0.13 )"
+
+S=${WORKDIR}/${MY_P}
+
+busybox_config_option() {
+       local flag=$1 ; shift
+       if [[ ${flag} != [yn] ]] ; then
+               busybox_config_option $(usex ${flag} y n) "$@"
+               return
+       fi
+       while [[ $# -gt 0 ]] ; do
+               if [[ ${flag} == "y" ]] ; then
+                       sed -i -e "s:.*\<CONFIG_$1\>.*set:CONFIG_$1=y:g" .config
+               else
+                       sed -i -e "s:CONFIG_$1=y:# CONFIG_$1 is not set:g" 
.config
+               fi
+               einfo $(grep "CONFIG_$1[= ]" .config || echo Could not find 
CONFIG_$1 ...)
+               shift
+       done
+}
+
+busybox_config_enabled() {
+       local val=$(sed -n "/^CONFIG_$1=/s:^[^=]*=::p" .config)
+       case ${val} in
+       "") return 1 ;;
+       y)  return 0 ;;
+       *)  echo "${val}" | sed -r 's:^"(.*)"$:\1:' ;;
+       esac
+}
+
+src_prepare() {
+       unset KBUILD_OUTPUT #88088
+       append-flags -fno-strict-aliasing #310413
+       use ppc64 && append-flags -mminimal-toc #130943
+
+       # patches go here!
+       epatch "${FILESDIR}"/${PN}-1.19.0-bb.patch
+       epatch "${FILESDIR}"/${P}-*.patch
+       cp "${FILESDIR}"/ginit.c init/ || die
+
+       # flag cleanup
+       sed -i -r \
+               -e 
's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g'
 \
+               Makefile.flags || die
+       #sed -i '/bbsh/s:^//::' include/applets.h
+       sed -i '/^#error Aborting compilation./d' applets/applets.c || die
+       use elibc_glibc && sed -i 's:-Wl,--gc-sections::' Makefile
+       sed -i \
+               -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
+               -e "/^AR\>/s:=.*:= $(tc-getAR):" \
+               -e "/^CC\>/s:=.*:= $(tc-getCC):" \
+               -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
+               -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
+               Makefile || die
+       sed -i \
+               -e 's:-static-libgcc::' \
+               Makefile.flags || die
+}
+
+src_configure() {
+       # check for a busybox config before making one of our own.
+       # if one exist lets return and use it.
+
+       restore_config .config
+       if [ -f .config ]; then
+               yes "" | emake -j1 -s oldconfig >/dev/null
+               return 0
+       else
+               ewarn "Could not locate user configfile, so we will save a 
default one"
+       fi
+
+       # setup the config file
+       emake -j1 -s allyesconfig >/dev/null
+       # nommu forces a bunch of things off which we want on #387555
+       busybox_config_option n NOMMU
+       sed -i '/^#/d' .config
+       yes "" | emake -j1 -s oldconfig >/dev/null
+
+       # now turn off stuff we really don't want
+       busybox_config_option n DMALLOC
+       busybox_config_option n FEATURE_SUID_CONFIG
+       busybox_config_option n BUILD_AT_ONCE
+       busybox_config_option n BUILD_LIBBUSYBOX
+       busybox_config_option n FEATURE_CLEAN_UP
+       busybox_config_option n MONOTONIC_SYSCALL
+       busybox_config_option n START_STOP_DAEMON
+       busybox_config_option n USE_PORTABLE_CODE
+       busybox_config_option n WERROR
+
+       # These causes trouble with musl.  Since we don't really
+       # depend on busybox for most of the musl work, we'll lazily
+       # just turn them off.
+       busybox_config_option n FEATURE_UTMP
+       busybox_config_option n EXTRA_COMPAT
+       busybox_config_option n FEATURE_VI_REGEX_SEARCH
+
+       # If these are not set and we are using a uclibc/busybox setup
+       # all calls to system() will fail.
+       busybox_config_option y ASH
+       busybox_config_option n HUSH
+
+       # disable ipv6 applets
+       if ! use ipv6; then
+               busybox_config_option n FEATURE_IPV6
+               busybox_config_option n TRACEROUTE6
+               busybox_config_option n PING6
+               busybox_config_option n UDHCPC6
+       fi
+
+       if use static && use pam ; then
+               ewarn "You cannot have USE='static pam'.  Assuming static is 
more important."
+       fi
+       busybox_config_option $(usex static n pam) PAM
+       busybox_config_option static STATIC
+       busybox_config_option syslog {K,SYS}LOGD LOGGER
+       busybox_config_option systemd FEATURE_SYSTEMD
+       busybox_config_option math FEATURE_AWK_LIBM
+
+       # all the debug options are compiler related, so punt them
+       busybox_config_option n DEBUG
+       busybox_config_option y NO_DEBUG_LIB
+       busybox_config_option n DMALLOC
+       busybox_config_option n EFENCE
+       busybox_config_option $(usex debug y n) TFTP_DEBUG
+
+       busybox_config_option selinux SELINUX
+
+       # this opt only controls mounting with <linux-2.6.23
+       busybox_config_option n FEATURE_MOUNT_NFS
+
+       # default a bunch of uncommon options to off
+       local opt
+       for opt in \
+               ADD_SHELL \
+               BEEP BOOTCHARTD \
+               CRONTAB \
+               DC DEVFSD DNSD DPKG{,_DEB} \
+               FAKEIDENTD FBSPLASH FOLD FSCK_MINIX FTP{GET,PUT} \
+               FEATURE_DEVFS \
+               HOSTID HUSH \
+               INETD INOTIFYD IPCALC \
+               LOCALE_SUPPORT LOGNAME LPD \
+               MAKEMIME MKFS_MINIX MSH \
+               OD \
+               RDEV READPROFILE REFORMIME REMOVE_SHELL RFKILL RUN_PARTS 
RUNSV{,DIR} \
+               SLATTACH SMEMCAP SULOGIN SV{,LOGD} \
+               TASKSET TCPSVD \
+               RPM RPM2CPIO \
+               UDPSVD UUDECODE UUENCODE
+       do
+               busybox_config_option n ${opt}
+       done
+
+       emake -j1 oldconfig > /dev/null
+}
+
+src_compile() {
+       unset KBUILD_OUTPUT #88088
+       export SKIP_STRIP=y
+
+       emake V=1 busybox
+}
+
+src_install() {
+       unset KBUILD_OUTPUT #88088
+       save_config .config
+
+       into /
+       dodir /bin
+       if use sep-usr ; then
+               # install /ginit to take care of mounting stuff
+               exeinto /
+               newexe busybox_unstripped ginit
+               dosym /ginit /bin/bb
+               dosym bb /bin/busybox
+       else
+               newbin busybox_unstripped busybox
+               dosym busybox /bin/bb
+       fi
+       if use mdev ; then
+               dodir /$(get_libdir)/mdev/
+               use make-symlinks || dosym /bin/bb /sbin/mdev
+               cp "${S}"/examples/mdev_fat.conf "${ED}"/etc/mdev.conf
+
+               exeinto /$(get_libdir)/mdev/
+               doexe "${FILESDIR}"/mdev/*
+
+               newinitd "${FILESDIR}"/mdev.initd mdev
+       fi
+       if use livecd ; then
+               dosym busybox /bin/vi
+       fi
+
+       # add busybox daemon's, bug #444718
+       if busybox_config_enabled FEATURE_NTPD_SERVER; then
+               newconfd "${FILESDIR}/ntpd.confd" "busybox-ntpd"
+               newinitd "${FILESDIR}/ntpd.initd" "busybox-ntpd"
+       fi
+       if busybox_config_enabled SYSLOGD; then
+               newconfd "${FILESDIR}/syslogd.confd" "busybox-syslogd"
+               newinitd "${FILESDIR}/syslogd.initd" "busybox-syslogd"
+       fi
+       if busybox_config_enabled KLOGD; then
+               newconfd "${FILESDIR}/klogd.confd" "busybox-klogd"
+               newinitd "${FILESDIR}/klogd.initd" "busybox-klogd"
+       fi
+       if busybox_config_enabled WATCHDOG; then
+               newconfd "${FILESDIR}/watchdog.confd" "busybox-watchdog"
+               newinitd "${FILESDIR}/watchdog.initd" "busybox-watchdog"
+       fi
+       if busybox_config_enabled UDHCPC; then
+               local path=$(busybox_config_enabled UDHCPC_DEFAULT_SCRIPT)
+               exeinto "${path%/*}"
+               newexe examples/udhcp/simple.script "${path##*/}"
+       fi
+       if busybox_config_enabled UDHCPD; then
+               insinto /etc
+               doins examples/udhcp/udhcpd.conf
+       fi
+
+       # bundle up the symlink files for use later
+       emake DESTDIR="${ED}" install
+       rm _install/bin/busybox
+       # for compatibility, provide /usr/bin/env
+       mkdir -p _install/usr/bin
+       ln -s /bin/env _install/usr/bin/env
+       tar cf busybox-links.tar -C _install . || : #;die
+       insinto /usr/share/${PN}
+       use make-symlinks && doins busybox-links.tar
+
+       dodoc AUTHORS README TODO
+
+       cd docs
+       docinto txt
+       dodoc *.txt
+       docinto pod
+       dodoc *.pod
+       dohtml *.html
+
+       cd ../examples
+       docinto examples
+       dodoc inittab depmod.pl *.conf *.script undeb unrpm
+}
+
+pkg_preinst() {
+       if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && 
[[ ${ROOT} == "/" ]] ; then
+               ewarn "setting USE=make-symlinks and emerging to / is very 
dangerous."
+               ewarn "it WILL overwrite lots of system programs like: ls bash 
awk grep (bug 60805 for full list)."
+               ewarn "If you are creating a binary only and not merging this 
is probably ok."
+               ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is really 
what you want."
+               die "silly options will destroy your system"
+       fi
+
+       if use make-symlinks ; then
+               mv "${ED}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die
+       fi
+}
+
+pkg_postinst() {
+       savedconfig_pkg_postinst
+
+       if use make-symlinks ; then
+               cd "${T}" || die
+               mkdir _install
+               tar xf busybox-links.tar -C _install || die
+               cp -vpPR _install/* "${ROOT}"/ || die "copying links for ${x} 
failed"
+       fi
+
+       if use sep-usr ; then
+               elog "In order to use the sep-usr support, you have to update 
your"
+               elog "kernel command line.  Add the option:"
+               elog "     init=/ginit"
+               elog "To launch a different init than /sbin/init, use:"
+               elog "     init=/ginit /sbin/yourinit"
+               elog "To get a rescue shell, you may boot with:"
+               elog "     init=/ginit bb"
+       fi
+}

diff --git a/sys-apps/busybox/files/busybox-1.24.1-unzip.patch 
b/sys-apps/busybox/files/busybox-1.24.1-unzip.patch
new file mode 100644
index 0000000..722b5fb
--- /dev/null
+++ b/sys-apps/busybox/files/busybox-1.24.1-unzip.patch
@@ -0,0 +1,112 @@
+https://bugs.gentoo.org/564246
+
+From 1de25a6e87e0e627aa34298105a3d17c60a1f44e Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <[email protected]>
+Date: Mon, 26 Oct 2015 19:33:05 +0100
+Subject: [PATCH] unzip: test for bad archive SEGVing
+
+function                                             old     new   delta
+huft_build                                          1296    1300      +4
+
+Signed-off-by: Denys Vlasenko <[email protected]>
+---
+ archival/libarchive/decompress_gunzip.c | 11 +++++++----
+ testsuite/unzip.tests                   | 23 ++++++++++++++++++++++-
+ 2 files changed, 29 insertions(+), 5 deletions(-)
+
+diff --git a/archival/libarchive/decompress_gunzip.c 
b/archival/libarchive/decompress_gunzip.c
+index 7b6f459..30bf451 100644
+--- a/archival/libarchive/decompress_gunzip.c
++++ b/archival/libarchive/decompress_gunzip.c
+@@ -305,11 +305,12 @@ static int huft_build(const unsigned *b, const unsigned 
n,
+       unsigned i;             /* counter, current code */
+       unsigned j;             /* counter */
+       int k;                  /* number of bits in current code */
+-      unsigned *p;            /* pointer into c[], b[], or v[] */
++      const unsigned *p;      /* pointer into c[], b[], or v[] */
+       huft_t *q;              /* points to current table */
+       huft_t r;               /* table entry for structure assignment */
+       huft_t *u[BMAX];        /* table stack */
+       unsigned v[N_MAX];      /* values in order of bit length */
++      unsigned v_end;
+       int ws[BMAX + 1];       /* bits decoded stack */
+       int w;                  /* bits decoded */
+       unsigned x[BMAX + 1];   /* bit offsets, then code stack */
+@@ -324,7 +325,7 @@ static int huft_build(const unsigned *b, const unsigned n,
+ 
+       /* Generate counts for each bit length */
+       memset(c, 0, sizeof(c));
+-      p = (unsigned *) b; /* cast allows us to reuse p for pointing to b */
++      p = b;
+       i = n;
+       do {
+               c[*p]++; /* assume all entries <= BMAX */
+@@ -365,12 +366,14 @@ static int huft_build(const unsigned *b, const unsigned 
n,
+       }
+ 
+       /* Make a table of values in order of bit lengths */
+-      p = (unsigned *) b;
++      p = b;
+       i = 0;
++      v_end = 0;
+       do {
+               j = *p++;
+               if (j != 0) {
+                       v[x[j]++] = i;
++                      v_end = x[j];
+               }
+       } while (++i < n);
+ 
+@@ -432,7 +435,7 @@ static int huft_build(const unsigned *b, const unsigned n,
+ 
+                       /* set up table entry in r */
+                       r.b = (unsigned char) (k - w);
+-                      if (p >= v + n) {
++                      if (p >= v + v_end) { // Was "if (p >= v + n)" but v[] 
can be shorter!
+                               r.e = 99; /* out of values--invalid code */
+                       } else if (*p < s) {
+                               r.e = (unsigned char) (*p < 256 ? 16 : 15);     
/* 256 is EOB code */
+diff --git a/testsuite/unzip.tests b/testsuite/unzip.tests
+index 8677a03..ca0a458 100755
+--- a/testsuite/unzip.tests
++++ b/testsuite/unzip.tests
+@@ -7,7 +7,7 @@
+ 
+ . ./testing.sh
+ 
+-# testing "test name" "options" "expected result" "file input" "stdin"
++# testing "test name" "commands" "expected result" "file input" "stdin"
+ #   file input will be file called "input"
+ #   test can create a file "actual" instead of writing to stdout
+ 
+@@ -30,6 +30,27 @@ testing "unzip (subdir only)" "unzip -q foo.zip foo/ && 
test -d foo && test ! -f
+ rmdir foo
+ rm foo.zip
+ 
++# File containing some damaged encrypted stream
++testing "unzip (bad archive)" "uudecode; unzip bad.zip 2>&1; echo \$?" \
++"Archive:  bad.zip
++  inflating: ]3j½r«IK-%Ix
++unzip: inflate error
++1
++" \
++"" "\
++begin-base64 644 bad.zip
++UEsDBBQAAgkIAAAAIQA5AAAANwAAADwAAAAQAAcAXTNqwr1ywqtJGxJLLSVJ
++eCkBD0AdKBk8JzQsIj01JC0/ORJQSwMEFAECCAAAAAAhADoAAAAPAAAANgAA
++AAwAAQASw73Ct1DCokohPXQiNjoUNTUiHRwgLT4WHlBLAQIQABQAAggIAAAA
++oQA5AAAANwAAADwAAAAQQAcADAAAACwAMgCAAAAAAABdM2rCvXLCq0kbEkst
++JUl4KQEPQB0oGSY4Cz4QNgEnJSYIPVBLAQIAABQAAggAAAAAIQAqAAAADwAA
++BDYAAAAMAAEADQAAADIADQAAAEEAAAASw73Ct1DKokohPXQiNzA+FAI1HCcW
++NzITNFBLBQUKAC4JAA04Cw0EOhZQSwUGAQAABAIAAgCZAAAAeQAAAAIALhM=
++====
++"
++
++rm *
++
+ # Clean up scratch directory.
+ 
+ cd ..
+-- 
+2.6.2
+

Reply via email to