[proaudio] [1760] Added dev-libs/icu needed by xerces-c-2.8.0 |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/proaudio Archives
]
Revision: 1760
Author: gentoid
Date: 2010-10-09 14:58:47 +0200 (Sat, 09 Oct 2010)
Log Message:
-----------
Added dev-libs/icu needed by xerces-c-2.8.0
Added Paths:
-----------
trunk/overlays/proaudio/dev-libs/icu/
trunk/overlays/proaudio/dev-libs/icu/ChangeLog
trunk/overlays/proaudio/dev-libs/icu/Manifest
trunk/overlays/proaudio/dev-libs/icu/files/
trunk/overlays/proaudio/dev-libs/icu/files/icu-3.6-regexp-CVE-2007-4770+4771.diff
trunk/overlays/proaudio/dev-libs/icu/icu-3.6-r2.ebuild
Added: trunk/overlays/proaudio/dev-libs/icu/ChangeLog
===================================================================
--- trunk/overlays/proaudio/dev-libs/icu/ChangeLog (rev 0)
+++ trunk/overlays/proaudio/dev-libs/icu/ChangeLog 2010-10-09 12:58:47 UTC (rev 1760)
@@ -0,0 +1,10 @@
+# ChangeLog for dev-libs/icu
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+*icu-3.6-r2 (09 Oct 2010)
+
+ 09 Oct 2010; Viktor Lazarev <taurus101v@xxxxxxxxx> +icu-3.6-r2.ebuild,
+ +files/icu-3.6-regexp-CVE-2007-4770+4771.diff:
+ Initial commit. Taken from official CVS tree. Needed by xerces-c-2.8.0
+
Added: trunk/overlays/proaudio/dev-libs/icu/Manifest
===================================================================
--- trunk/overlays/proaudio/dev-libs/icu/Manifest (rev 0)
+++ trunk/overlays/proaudio/dev-libs/icu/Manifest 2010-10-09 12:58:47 UTC (rev 1760)
@@ -0,0 +1,4 @@
+AUX icu-3.6-regexp-CVE-2007-4770+4771.diff 10813 RMD160 e28e0704389087b49263b93781cfaf8564ba7bd0 SHA1 42da32eb2aaa9ffed8b67d88268d8b144186cbb6 SHA256 ae908b683114b4874a84abdee963bcf6ff4dd65f9ba045b1843dffa1df7ac02f
+DIST icu4c-3_6-src.tgz 10183358 RMD160 b227ac9ff6019362bc4d01c18433869b0e0ff1c2 SHA1 b580c2802e74eb6af7e5e19b05c7d7c5d8c623f9 SHA256 5135e8d69d6206d320515df7aeee7027711ab1aef9d8dbf29571a97a9746b041
+EBUILD icu-3.6-r2.ebuild 960 RMD160 e0aa5f4060181c0ed6d35fd312e2359250ccbd25 SHA1 8332ea072f3099910af9e763c590861f8c9c0fbc SHA256 b3e44e29414a4e9e80de7e4e58f78562c1798669278f55cb1c59c689f7552475
+MISC ChangeLog 336 RMD160 2622a347e10fd1fe36122b3bb151fbbc8aba12f7 SHA1 3d1e8ca8901c42d8cd0f5a60ac48f7a5b890547f SHA256 c7cbeaba808246b01b8314e94ebdd87251b3c05fd34237ae4cac124bc88d4437
Added: trunk/overlays/proaudio/dev-libs/icu/files/icu-3.6-regexp-CVE-2007-4770+4771.diff
===================================================================
--- trunk/overlays/proaudio/dev-libs/icu/files/icu-3.6-regexp-CVE-2007-4770+4771.diff (rev 0)
+++ trunk/overlays/proaudio/dev-libs/icu/files/icu-3.6-regexp-CVE-2007-4770+4771.diff 2010-10-09 12:58:47 UTC (rev 1760)
@@ -0,0 +1,309 @@
+# borrowed from redhat -- https://bugzilla.redhat.com/show_bug.cgi?id=429023
+
+diff -ru icu.orig/source/common/uvectr32.cpp icu/source/common/uvectr32.cpp
+--- icu.orig/source/common/uvectr32.cpp 2003-08-27 02:01:30.000000000 +0100
++++ icu/source/common/uvectr32.cpp 2008-01-22 08:37:06.000000000 +0000
+@@ -1,6 +1,6 @@
+ /*
+ ******************************************************************************
+-* Copyright (C) 1999-2003, International Business Machines Corporation and *
++* Copyright (C) 1999-2008, International Business Machines Corporation and *
+ * others. All Rights Reserved. *
+ ******************************************************************************
+ * Date Name Description
+@@ -26,6 +26,7 @@
+ UVector32::UVector32(UErrorCode &status) :
+ count(0),
+ capacity(0),
++ maxCapacity(0),
+ elements(NULL)
+ {
+ _init(DEFUALT_CAPACITY, status);
+@@ -34,6 +35,7 @@
+ UVector32::UVector32(int32_t initialCapacity, UErrorCode &status) :
+ count(0),
+ capacity(0),
++ maxCapacity(0),
+ elements(0)
+ {
+ _init(initialCapacity, status);
+@@ -46,6 +48,9 @@
+ if (initialCapacity < 1) {
+ initialCapacity = DEFUALT_CAPACITY;
+ }
++ if (maxCapacity>0 && maxCapacity<initialCapacity) {
++ initialCapacity = maxCapacity;
++ }
+ elements = (int32_t *)uprv_malloc(sizeof(int32_t)*initialCapacity);
+ if (elements == 0) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+@@ -189,21 +194,35 @@
+ UBool UVector32::expandCapacity(int32_t minimumCapacity, UErrorCode &status) {
+ if (capacity >= minimumCapacity) {
+ return TRUE;
+- } else {
+- int32_t newCap = capacity * 2;
+- if (newCap < minimumCapacity) {
+- newCap = minimumCapacity;
+- }
+- int32_t* newElems = (int32_t *)uprv_malloc(sizeof(int32_t)*newCap);
+- if (newElems == 0) {
+- status = U_MEMORY_ALLOCATION_ERROR;
+- return FALSE;
+- }
+- uprv_memcpy(newElems, elements, sizeof(elements[0]) * count);
+- uprv_free(elements);
+- elements = newElems;
+- capacity = newCap;
+- return TRUE;
++ }
++ if (maxCapacity>0 && minimumCapacity>maxCapacity) {
++ status = U_BUFFER_OVERFLOW_ERROR;
++ return FALSE;
++ }
++ int32_t newCap = capacity * 2;
++ if (newCap < minimumCapacity) {
++ newCap = minimumCapacity;
++ }
++ if (maxCapacity > 0 && newCap > maxCapacity) {
++ newCap = maxCapacity;
++ }
++ int32_t* newElems = (int32_t *)uprv_malloc(sizeof(int32_t)*newCap);
++ if (newElems == 0) {
++ status = U_MEMORY_ALLOCATION_ERROR;
++ return FALSE;
++ }
++ uprv_memcpy(newElems, elements, sizeof(elements[0]) * count);
++ uprv_free(elements);
++ elements = newElems;
++ capacity = newCap;
++ return TRUE;
++}
++
++void UVector32::setMaxCapacity(int32_t limit) {
++ U_ASSERT(limit >= 0);
++ maxCapacity = limit;
++ if (maxCapacity < 0) {
++ maxCapacity = 0;
+ }
+ }
+
+diff -ru icu.orig/source/common/uvectr32.h icu/source/common/uvectr32.h
+--- icu.orig/source/common/uvectr32.h 2006-01-18 03:52:04.000000000 +0000
++++ icu/source/common/uvectr32.h 2008-01-22 08:37:07.000000000 +0000
+@@ -1,6 +1,6 @@
+ /*
+ **********************************************************************
+-* Copyright (C) 1999-2006, International Business Machines
++* Copyright (C) 1999-2008, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ */
+@@ -61,6 +61,8 @@
+ int32_t count;
+
+ int32_t capacity;
++
++ int32_t maxCapacity; // Limit beyond which capacity is not permitted to grow.
+
+ int32_t* elements;
+
+@@ -162,6 +164,14 @@
+ int32_t *getBuffer() const;
+
+ /**
++ * Set the maximum allowed buffer capacity for this vector/stack.
++ * Default with no limit set is unlimited, go until malloc() fails.
++ * A Limit of zero means unlimited capacity.
++ * Units are vector elements (32 bits each), not bytes.
++ */
++ void setMaxCapacity(int32_t limit);
++
++ /**
+ * ICU "poor man's RTTI", returns a UClassID for this class.
+ */
+ static UClassID U_EXPORT2 getStaticClassID();
+@@ -221,7 +231,9 @@
+ }
+
+ inline int32_t *UVector32::reserveBlock(int32_t size, UErrorCode &status) {
+- ensureCapacity(count+size, status);
++ if (ensureCapacity(count+size, status) == FALSE) {
++ return NULL;
++ }
+ int32_t *rp = elements+count;
+ count += size;
+ return rp;
+diff -ru icu.orig/source/i18n/regexcmp.cpp icu/source/i18n/regexcmp.cpp
+--- icu.orig/source/i18n/regexcmp.cpp 2006-02-02 04:37:14.000000000 +0000
++++ icu/source/i18n/regexcmp.cpp 2008-01-22 08:37:06.000000000 +0000
+@@ -1187,14 +1187,17 @@
+ // Because capture groups can be forward-referenced by back-references,
+ // we fill the operand with the capture group number. At the end
+ // of compilation, it will be changed to the variable's location.
+- U_ASSERT(groupNum > 0);
+- int32_t op;
+- if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
+- op = URX_BUILD(URX_BACKREF_I, groupNum);
++ if (groupNum < 1) {
++ error(U_REGEX_INVALID_BACK_REF);
+ } else {
+- op = URX_BUILD(URX_BACKREF, groupNum);
++ int32_t op;
++ if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
++ op = URX_BUILD(URX_BACKREF_I, groupNum);
++ } else {
++ op = URX_BUILD(URX_BACKREF, groupNum);
++ }
++ fRXPat->fCompiledPat->addElement(op, *fStatus);
+ }
+- fRXPat->fCompiledPat->addElement(op, *fStatus);
+ }
+ break;
+
+diff -ru icu.orig/source/i18n/rematch.cpp icu/source/i18n/rematch.cpp
+--- icu.orig/source/i18n/rematch.cpp 2005-08-25 19:02:20.000000000 +0100
++++ icu/source/i18n/rematch.cpp 2008-01-22 08:37:44.000000000 +0000
+@@ -30,6 +30,15 @@
+
+ U_NAMESPACE_BEGIN
+
++// Limit the size of the back track stack, to avoid system failures caused
++// by heap exhaustion. Units are in 32 bit words, not bytes.
++// This value puts ICU's limits higher than most other regexp implementations,
++// which use recursion rather than the heap, and take more storage per
++// backtrack point.
++// This constant is _temporary_. Proper API to control the value will added.
++//
++static const int32_t BACKTRACK_STACK_CAPACITY = 8000000;
++
+ //-----------------------------------------------------------------------------
+ //
+ // Constructor and Destructor
+@@ -53,6 +62,8 @@
+ }
+ if (fStack == NULL || fData == NULL) {
+ fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
++ } else {
++ fStack->setMaxCapacity(BACKTRACK_STACK_CAPACITY);
+ }
+
+ reset(*RegexStaticSets::gStaticSets->fEmptyString);
+@@ -78,6 +89,8 @@
+ }
+ if (fStack == NULL || fData == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
++ } else {
++ fStack->setMaxCapacity(BACKTRACK_STACK_CAPACITY);
+ }
+ reset(input);
+ }
+@@ -102,6 +115,8 @@
+ }
+ if (fStack == NULL || fData == NULL) {
+ status = U_MEMORY_ALLOCATION_ERROR;
++ } else {
++ fStack->setMaxCapacity(BACKTRACK_STACK_CAPACITY);
+ }
+ reset(*RegexStaticSets::gStaticSets->fEmptyString);
+ }
+@@ -1015,6 +1030,14 @@
+ inline REStackFrame *RegexMatcher::StateSave(REStackFrame *fp, int32_t savePatIdx, int32_t frameSize, UErrorCode &status) {
+ // push storage for a new frame.
+ int32_t *newFP = fStack->reserveBlock(frameSize, status);
++ if (newFP == NULL) {
++ // Heap allocation error on attempted stack expansion.
++ // We need to return a writable stack frame, so just return the
++ // previous frame. The match operation will stop quickly
++ // becuase of the error status, after which the frame will never
++ // be looked at again.
++ return fp;
++ }
+ fp = (REStackFrame *)(newFP - frameSize); // in case of realloc of stack.
+
+ // New stack frame = copy of old top frame.
+@@ -1030,8 +1053,8 @@
+ fp->fPatIdx = savePatIdx;
+ return (REStackFrame *)newFP;
+ }
+-
+-
++
++
+ //--------------------------------------------------------------------------------
+ //
+ // MatchAt This is the actual matching engine.
+@@ -2262,6 +2285,7 @@
+ }
+
+ if (U_FAILURE(status)) {
++ isMatch = FALSE;
+ break;
+ }
+ }
+diff -ru icu.orig/source/test/intltest/regextst.cpp icu/source/test/intltest/regextst.cpp
+--- icu.orig/source/test/intltest/regextst.cpp 2005-07-05 19:39:00.000000000 +0100
++++ icu/source/test/intltest/regextst.cpp 2008-01-22 08:38:21.000000000 +0000
+@@ -66,6 +66,10 @@
+ case 6: name = "PerlTests";
+ if (exec) PerlTests();
+ break;
++ case 7: name = "Bug 6149";
++ if (exec) Bug6149();
++ break;
++
+
+
+ default: name = "";
+@@ -1637,6 +1641,13 @@
+ // UnicodeSet containing a string
+ REGEX_ERR("abc[{def}]xyz", 1, 10, U_REGEX_SET_CONTAINS_STRING);
+
++
++ // Invalid Back Reference \0
++ // For ICU 3.8 and earlier
++ // For ICU versions newer than 3.8, \0 introduces an octal escape.
++ //
++ REGEX_ERR("(ab)\\0", 1, 6, U_REGEX_INVALID_BACK_REF);
++
+ }
+
+
+@@ -2119,6 +2130,26 @@
+ }
+
+
++//--------------------------------------------------------------
++//
++// Bug6149 Verify limits to heap expansion for backtrack stack.
++// Use this pattern,
++// "(a?){1,}"
++// The zero-length match will repeat forever.
++// (That this goes into a loop is another bug)
++//
++//---------------------------------------------------------------
++void RegexTest::Bug6149() {
++ UnicodeString pattern("(a?){1,}");
++ UnicodeString s("xyz");
++ uint32_t flags = 0;
++ UErrorCode status = U_ZERO_ERROR;
++
++ RegexMatcher matcher(pattern, s, flags, status);
++ UBool result = false;
++ REGEX_ASSERT_FAIL(result=matcher.matches(status), U_BUFFER_OVERFLOW_ERROR);
++ REGEX_ASSERT(result == FALSE);
++ }
+
+ #endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */
+
+diff -ru icu.orig/source/test/intltest/regextst.h icu/source/test/intltest/regextst.h
+--- icu.orig/source/test/intltest/regextst.h 2003-12-03 06:58:28.000000000 +0000
++++ icu/source/test/intltest/regextst.h 2008-01-22 08:37:06.000000000 +0000
+@@ -30,6 +30,7 @@
+ virtual void Extended();
+ virtual void Errors();
+ virtual void PerlTests();
++ virtual void Bug6149();
+
+ // The following functions are internal to the regexp tests.
+ virtual UBool doRegexLMTest(const char *pat, const char *text, UBool looking, UBool match, int line);
Added: trunk/overlays/proaudio/dev-libs/icu/icu-3.6-r2.ebuild
===================================================================
--- trunk/overlays/proaudio/dev-libs/icu/icu-3.6-r2.ebuild (rev 0)
+++ trunk/overlays/proaudio/dev-libs/icu/icu-3.6-r2.ebuild 2010-10-09 12:58:47 UTC (rev 1760)
@@ -0,0 +1,35 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/icu/Attic/icu-3.6-r2.ebuild,v 1.9 2010/04/16 00:04:52 arfrever dead $
+
+inherit eutils
+
+DESCRIPTION="IBM Internationalization Components for Unicode"
+HOMEPAGE="http://ibm.com/software/globalization/icu/"
+SRC_URI="ftp://ftp.software.ibm.com/software/globalization/icu/${PV}/icu4c-${PV/./_}-src.tgz"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+IUSE="debug"
+
+DEPEND=""
+RDEPEND=""
+
+S=${WORKDIR}/${PN}/source
+
+src_unpack() {
+ unpack ${A}
+ # Bug 208001
+ epatch "${FILESDIR}"/${PN}-3.6-regexp-CVE-2007-4770+4771.diff
+}
+
+src_compile() {
+ econf --enable-static $(use_enable debug) || die "econf failed"
+ emake -j1 || die "emake failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+ dohtml ../readme.html ../license.html
+}