Fix buffer overflow in pkgdata (bug #285735). Add "static-libs" USE flag (bug #319643).
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
Sat, 12 Jun 2010 16:36:46 +0000 (16:36 +0000)
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
Sat, 12 Jun 2010 16:36:46 +0000 (16:36 +0000)
Package-Manager: portage-HEAD/cvs/Linux x86_64

dev-libs/icu/ChangeLog
dev-libs/icu/files/icu-4.4.1-pkgdata.patch [new file with mode: 0644]
dev-libs/icu/icu-4.4.1.ebuild

index 4d77740c3814ae64b33de99b7660f197bdd77f6c..1ce643ccf2a84016f6e21849af25da01fbb3ee33 100644 (file)
@@ -1,6 +1,11 @@
 # ChangeLog for dev-libs/icu
 # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/icu/ChangeLog,v 1.109 2010/06/05 21:36:14 arfrever Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/icu/ChangeLog,v 1.110 2010/06/12 16:36:46 arfrever Exp $
+
+  12 Jun 2010; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
+  icu-4.4.1.ebuild, +files/icu-4.4.1-pkgdata.patch:
+  Fix buffer overflow in pkgdata (bug #285735). Add "static-libs" USE flag
+  (bug #319643).
 
   05 Jun 2010; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
   icu-4.4.1.ebuild:
diff --git a/dev-libs/icu/files/icu-4.4.1-pkgdata.patch b/dev-libs/icu/files/icu-4.4.1-pkgdata.patch
new file mode 100644 (file)
index 0000000..8a1a5bc
--- /dev/null
@@ -0,0 +1,80 @@
+https://bugs.icu-project.org/trac/ticket/7663
+https://bugs.icu-project.org/trac/changeset/28002
+https://bugs.icu-project.org/trac/ticket/7680
+https://bugs.icu-project.org/trac/changeset/28124
+
+--- source/tools/pkgdata/pkgdata.cpp
++++ source/tools/pkgdata/pkgdata.cpp
+@@ -98,6 +98,7 @@
+ #endif
+ 
+ #define LARGE_BUFFER_MAX_SIZE 2048
++#define MEDIUM_BUFFER_MAX_SIZE 1024
+ #define SMALL_BUFFER_MAX_SIZE 512
+ 
+ static void loadLists(UPKGOptions *o, UErrorCode *status);
+@@ -472,29 +473,48 @@
+ }
+ 
+ static int runCommand(const char* command, UBool specialHandling) {
+-    char cmd[SMALL_BUFFER_MAX_SIZE];
++    char *cmd = NULL;
++    char cmdBuffer[SMALL_BUFFER_MAX_SIZE];
++    int32_t len = strlen(command);
++
++    if (len == 0) {
++        return 0;
++    }
+ 
+     if (!specialHandling) {
++#if defined(USING_CYGWIN) || defined(OS400)
++#define CMD_PADDING_SIZE 20
++        if ((len + CMD_PADDING_SIZE) >= SMALL_BUFFER_MAX_SIZE) {
++            cmd = (char *)uprv_malloc(len + CMD_PADDING_SIZE);
++        } else {
++            cmd = cmdBuffer;
++        }
+ #ifdef USING_CYGWIN
+         sprintf(cmd, "bash -c \"%s\"", command);
+ 
+ #elif defined(OS400)
+         sprintf(cmd, "QSH CMD('%s')", command);
++#endif
+ #else
+         goto normal_command_mode;
+ #endif
+     } else {
+ normal_command_mode:
+-        sprintf(cmd, "%s", command);
++        cmd = (char *)command;
+     }
+-    
++
+     printf("pkgdata: %s\n", cmd);
+     int result = system(cmd);
+-    if (result != 0) { 
+-        printf("-- return status = %d\n", result); 
++    if (result != 0) {
++        printf("-- return status = %d\n", result);
+     }
+-    return result; 
+-} 
++
++    if (cmd != cmdBuffer && cmd != command) {
++        uprv_free(cmd);
++    }
++
++    return result;
++}
+ 
+ #define LN_CMD "ln -s"
+ #define RM_CMD "rm -f"
+@@ -586,7 +606,7 @@
+             pkgDataFlags = (char**)uprv_malloc(sizeof(char*) * PKGDATA_FLAGS_SIZE);
+             if (pkgDataFlags != NULL) {
+                 for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
+-                    pkgDataFlags[i] = (char*)uprv_malloc(sizeof(char) * SMALL_BUFFER_MAX_SIZE);
++                    pkgDataFlags[i] = (char*)uprv_malloc(sizeof(char) * MEDIUM_BUFFER_MAX_SIZE);
+                     if (pkgDataFlags[i] != NULL) {
+                         pkgDataFlags[i][0] = 0;
+                     } else {
index a6dc8a7af184958a9f10b59b10c5ab2c1b461728..d80313e87a6a21b9933addd6775426f996be1ef5 100644 (file)
@@ -1,12 +1,13 @@
 # Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/icu/icu-4.4.1.ebuild,v 1.3 2010/06/05 21:36:14 arfrever Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/icu/icu-4.4.1.ebuild,v 1.4 2010/06/12 16:36:46 arfrever Exp $
 
 EAPI="3"
 
-inherit flag-o-matic versionator
+inherit eutils flag-o-matic versionator
 
 MAJOR_MINOR_VERSION="$(get_version_component_range 1-2)"
+MICRO_VERSION="$(get_version_component_range 3)"
 
 DESCRIPTION="International Components for Unicode"
 HOMEPAGE="http://www.icu-project.org/"
@@ -22,14 +23,14 @@ SRC_URI="${BASE_URI}/${SRC_ARCHIVE}
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86 ~x86-fbsd"
-IUSE="debug doc examples"
+IUSE="debug doc examples static-libs"
 
 DEPEND="doc? ( app-arch/unzip )"
 RDEPEND=""
 
 S="${WORKDIR}/${PN}/source"
 
-QA_DT_NEEDED="/usr/lib.*/libicudata.so.${MAJOR_MINOR_VERSION/./}.0"
+QA_DT_NEEDED="/usr/lib.*/libicudata.so.${MAJOR_MINOR_VERSION/./}.${MICRO_VERSION:-0}"
 
 src_unpack() {
        unpack "${SRC_ARCHIVE}"
@@ -48,13 +49,17 @@ src_prepare() {
        for x in ARFLAGS CFLAGS CPPFLAGS CXXFLAGS FFLAGS LDFLAGS; do
                sed -i -e "/^${x} =.*/s:@${x}@::" "config/Makefile.inc.in" || die "sed failed"
        done
+
+       epatch "${FILESDIR}/${P}-pkgdata.patch"
 }
 
 src_configure() {
+       append-flags -fno-strict-aliasing
+
        econf \
-               --enable-static \
                $(use_enable debug) \
-               $(use_enable examples samples)
+               $(use_enable examples samples) \
+               $(use_enable static-libs static)
 }
 
 src_test() {