summaryrefslogtreecommitdiffstats
path: root/icu.icu7039.badextract.patch
blob: 3b277625561ff1270dbf80e064646cc384fd0ed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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 ? (((size_t)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;
     }