rpms/icu/devel icu.icu7039.badextract.patch, NONE, 1.1 icu.spec, 1.99, 1.100

Caolan McNamara caolanm at fedoraproject.org
Tue Jul 28 15:58:09 UTC 2009


Author: caolanm

Update of /cvs/pkgs/rpms/icu/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17271

Modified Files:
	icu.spec 
Added Files:
	icu.icu7039.badextract.patch 
Log Message:
icu#7039 fix broken use of extract to get tests working

icu.icu7039.badextract.patch:
 common/unicode/unistr.h    |    2 +-
 test/intltest/dadrcal.cpp  |    8 ++++----
 test/intltest/dadrcoll.cpp |    2 +-
 test/intltest/dadrfmt.cpp  |    4 ++--
 test/intltest/loctest.cpp  |    2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

--- NEW FILE icu.icu7039.badextract.patch ---
diff -ru icu.orig/source/common/unicode/unistr.h icu/source/common/unicode/unistr.h
--- icu.orig/source/common/unicode/unistr.h	2009-07-28 16:02:03.000000000 +0100
+++ icu/source/common/unicode/unistr.h	2009-07-28 16:36:48.000000000 +0100
@@ -4048,7 +4048,7 @@
 
 {
   // This dstSize value will be checked explicitly
-  return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage);
+  return extract(start, _length, dst, dst!=0 ? ((dst >= ((size_t)-1) - UINT32_MAX) ? (((char*)UINT32_MAX) - dst) : UINT32_MAX) : 0, codepage);
 }
 
 #endif
diff -ru icu.orig/source/test/intltest/dadrcal.cpp icu/source/test/intltest/dadrcal.cpp
--- icu.orig/source/test/intltest/dadrcal.cpp	2009-07-28 16:01:10.000000000 +0100
+++ icu/source/test/intltest/dadrcal.cpp	2009-07-28 16:52:15.000000000 +0100
@@ -114,7 +114,7 @@
                     + UnicodeString(" - "));
             continue;
         }
-        testSetting.extract(0, testSetting.length(), toCalLoc, (const char*)0);
+        testSetting.extract(0, testSetting.length(), toCalLoc, sizeof(toCalLoc)-1, (const char*)0);
         fromCalendar = Calendar::createInstance(toCalLoc, status);
         if (U_FAILURE(status)) {
             errln(caseString+": Unable to instantiate calendar for "
@@ -371,7 +371,7 @@
     // build to calendar
     UnicodeString testSetting = settings->getString("ToCalendar", status);
     if (U_SUCCESS(status)) {
-        testSetting.extract(0, testSetting.length(), toCalLoc, (const char*)0);
+        testSetting.extract(0, testSetting.length(), toCalLoc, sizeof(toCalLoc)-1, (const char*)0);
         toCalendar = Calendar::createInstance(toCalLoc, status);
         if (U_FAILURE(status)) {
             errln("Unable to instantiate ToCalendar for "+testSetting);
@@ -394,7 +394,7 @@
         Calendar *fromCalendar= NULL;
         UnicodeString locale = currentCase->getString("locale", status);
         if (U_SUCCESS(status)) {
-            locale.extract(0, locale.length(), fromCalLoc, (const char*)0); // default codepage.  Invariant codepage doesn't have '@'!
+            locale.extract(0, locale.length(), fromCalLoc, sizeof(fromCalLoc)-1, (const char*)0); // default codepage.  Invariant codepage doesn't have '@'!
             fromCalendar = Calendar::createInstance(fromCalLoc, status);
             if (U_FAILURE(status)) {
                 errln("Unable to instantiate fromCalendar for "+locale);
@@ -464,7 +464,7 @@
                 logln("---");
             }
             logln(testSetting + "---");
-            testSetting.extract(0, testSetting.length(), testType, "");
+            testSetting.extract(0, testSetting.length(), testType, sizeof(testType)-1, "");
         } else {
             errln("Unable to extract 'Type'. Skipping..");
             continue;
diff -ru icu.orig/source/test/intltest/dadrcoll.cpp icu/source/test/intltest/dadrcoll.cpp
--- icu.orig/source/test/intltest/dadrcoll.cpp	2009-07-28 16:01:10.000000000 +0100
+++ icu/source/test/intltest/dadrcoll.cpp	2009-07-28 16:49:56.000000000 +0100
@@ -179,7 +179,7 @@
     testSetting = settings->getString("TestLocale", intStatus);
     if(U_SUCCESS(intStatus)) {
       char localeName[256];
-      testSetting.extract(0, testSetting.length(), localeName, "");
+      testSetting.extract(0, testSetting.length(), localeName, sizeof(localeName)-1, "");
       col = Collator::createInstance(localeName, status);
       if(U_SUCCESS(status)) {
         logln("Testing collator for locale "+testSetting);
diff -ru icu.orig/source/test/intltest/dadrfmt.cpp icu/source/test/intltest/dadrfmt.cpp
--- icu.orig/source/test/intltest/dadrfmt.cpp	2009-07-28 16:01:10.000000000 +0100
+++ icu/source/test/intltest/dadrfmt.cpp	2009-07-28 16:50:36.000000000 +0100
@@ -149,7 +149,7 @@
         DateFormat *format = NULL;
         
         // Process: 'locale'
-        locale.extract(0, locale.length(), calLoc, (const char*)0); // default codepage.  Invariant codepage doesn't have '@'!
+        locale.extract(0, locale.length(), calLoc, sizeof(calLoc)-1, (const char*)0); // default codepage.  Invariant codepage doesn't have '@'!
         Locale loc(calLoc);
         if(spec.startsWith(kPATTERN)) {
             pattern = UnicodeString(spec,kPATTERN.length());
@@ -323,7 +323,7 @@
                 logln("---");
             }
             logln(testSetting + "---");
-            testSetting.extract(0, testSetting.length(), testType, "");
+            testSetting.extract(0, testSetting.length(), testType, sizeof(testType)-1, "");
         } else {
             errln("Unable to extract 'Type'. Skipping..");
             continue;
diff -ru icu.orig/source/test/intltest/loctest.cpp icu/source/test/intltest/loctest.cpp
--- icu.orig/source/test/intltest/loctest.cpp	2009-07-28 16:01:10.000000000 +0100
+++ icu/source/test/intltest/loctest.cpp	2009-07-28 16:51:30.000000000 +0100
@@ -616,7 +616,7 @@
     {
       char *ch;
       ch = new char[l.length() + 1];
-      ch[l.extract(0, 0x7fffffff, ch, "")] = 0;
+      ch[l.extract(0, 0x7fffffff, ch, l.length(), "")] = 0;
       setFromPOSIXID(ch);
       delete [] ch;
     }


Index: icu.spec
===================================================================
RCS file: /cvs/pkgs/rpms/icu/devel/icu.spec,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -p -r1.99 -r1.100
--- icu.spec	25 Jul 2009 03:08:21 -0000	1.99
+++ icu.spec	28 Jul 2009 15:58:09 -0000	1.100
@@ -1,6 +1,6 @@
 Name:      icu
 Version:   4.2.1
-Release:   4%{?dist}
+Release:   5%{?dist}
 Summary:   International Components for Unicode
 Group:     Development/Tools
 License:   MIT
@@ -14,6 +14,7 @@ Requires: lib%{name} = %{version}-%{rele
 Patch1:  icu-3.4-multiarchdevel.patch
 Patch2:  icu.icu6284.strictalias.patch
 Patch3:  icu.6995.kannada.patch
+Patch4:  icu.icu7039.badextract.patch
 
 %description
 Tools and utilities for developing with icu.
@@ -55,7 +56,8 @@ BuildArch: noarch
 %setup -q -n %{name}
 %patch1 -p1 -b .multiarchdevel
 %patch2 -p1 -b .icu6284.strictalias.patch
-%patch3 -p1 -b .icu.6995.kannada.patch
+%patch3 -p1 -b .icu6995.kannada.patch
+%patch4 -p1 -b .icu7039.badextract.patch
 
 %build
 cd source
@@ -76,6 +78,9 @@ chmod 0755 $RPM_BUILD_ROOT%{_bindir}/%{n
 sed -i s/\\\$\(THREADSCXXFLAGS\)// $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/icu.pc
 sed -i s/\\\$\(THREADSCPPFLAGS\)/-D_REENTRANT/ $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/icu.pc
 
+%check
+make -C source check
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -131,6 +136,9 @@ rm -rf $RPM_BUILD_ROOT
 %doc source/__docs/%{name}/html/*
 
 %changelog
+* Tue Jul 28 2009 Caolan McNamara <caolanm at redhat.com> - 4.2.1-5
+- icu#7039 fix broken use of extract to get tests working
+
 * Fri Jul 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 4.2.1-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
 




More information about the fedora-extras-commits mailing list