Compare commits

..

No commits in common. "c10-beta" and "c8" have entirely different histories.
c10-beta ... c8

12 changed files with 697 additions and 163 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
icu4c-74_2-src-FIXED.tgz SOURCES/icu4c-60_3-src.tgz

1
.icu.metadata Normal file
View File

@ -0,0 +1 @@
83e6eb1931aac0aae6e313b306b3ca332c017bc3 SOURCES/icu4c-60_3-src.tgz

View File

@ -0,0 +1,108 @@
From 23d76d88630ecee02515e2c8f5c8769cc795ae23 Mon Sep 17 00:00:00 2001
From: Shane Carr <shane@unicode.org>
Date: Fri, 23 Mar 2018 00:56:16 +0000
Subject: [PATCH] ICU-13634 Adding integer overflow logic to ICU4C number
pipeline in places where it is in ICU4J.
X-SVN-Rev: 41136
diff --git a/icu4c/source/common/putil.cpp b/icu4c/source/common/putil.cpp
index 83f08ac070..452e2fd79c 100644
--- a/icu4c/source/common/putil.cpp
+++ b/icu4c/source/common/putil.cpp
@@ -533,6 +533,30 @@ uprv_fmin(double x, double y)
return (x > y ? y : x);
}
+#include <iostream>
+
+U_CAPI UBool U_EXPORT2
+uprv_add32_overflow(int32_t a, int32_t b, int32_t* res) {
+ // NOTE: Some compilers (GCC, Clang) have primitives available, like __builtin_add_overflow.
+ // This function could be optimized by calling one of those primitives.
+ auto a64 = static_cast<int64_t>(a);
+ auto b64 = static_cast<int64_t>(b);
+ int64_t res64 = a64 + b64;
+ *res = static_cast<int32_t>(res64);
+ return res64 != *res;
+}
+
+U_CAPI UBool U_EXPORT2
+uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res) {
+ // NOTE: Some compilers (GCC, Clang) have primitives available, like __builtin_mul_overflow.
+ // This function could be optimized by calling one of those primitives.
+ auto a64 = static_cast<int64_t>(a);
+ auto b64 = static_cast<int64_t>(b);
+ int64_t res64 = a64 * b64;
+ *res = static_cast<int32_t>(res64);
+ return res64 != *res;
+}
+
/**
* Truncates the given double.
* trunc(3.3) = 3.0, trunc (-3.3) = -3.0
diff --git a/icu4c/source/common/putilimp.h b/icu4c/source/common/putilimp.h
index eb9b5380f1..8b858df9e3 100644
--- a/icu4c/source/common/putilimp.h
+++ b/icu4c/source/common/putilimp.h
@@ -391,6 +391,32 @@ U_INTERNAL double U_EXPORT2 uprv_log(double d);
*/
U_INTERNAL double U_EXPORT2 uprv_round(double x);
+/**
+ * Adds the signed integers a and b, storing the result in res.
+ * Checks for signed integer overflow.
+ * Similar to the GCC/Clang extension __builtin_add_overflow
+ *
+ * @param a The first operand.
+ * @param b The second operand.
+ * @param res a + b
+ * @return true if overflow occurred; false if no overflow occurred.
+ * @internal
+ */
+U_INTERNAL UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* res);
+
+/**
+ * Multiplies the signed integers a and b, storing the result in res.
+ * Checks for signed integer overflow.
+ * Similar to the GCC/Clang extension __builtin_mul_overflow
+ *
+ * @param a The first multiplicand.
+ * @param b The second multiplicand.
+ * @param res a * b
+ * @return true if overflow occurred; false if no overflow occurred.
+ * @internal
+ */
+U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res);
+
#if 0
/**
* Returns the number of digits after the decimal point in a double number x.
diff --git a/icu4c/source/test/cintltst/putiltst.c b/icu4c/source/test/cintltst/putiltst.c
index b99d9fca9c..1c3e073041 100644
--- a/icu4c/source/test/cintltst/putiltst.c
+++ b/icu4c/source/test/cintltst/putiltst.c
@@ -128,6 +128,20 @@ static void TestPUtilAPI(void){
log_err("ERROR: uprv_isInfinite failed.\n");
}
+ log_verbose("Testing the APIs uprv_add32_overflow and uprv_mul32_overflow\n");
+ int32_t overflow_result;
+ doAssert(FALSE, uprv_add32_overflow(INT32_MAX - 2, 1, &overflow_result), "should not overflow");
+ doAssert(INT32_MAX - 1, overflow_result, "should equal INT32_MAX - 1");
+ doAssert(FALSE, uprv_add32_overflow(INT32_MAX - 2, 2, &overflow_result), "should not overflow");
+ doAssert(INT32_MAX, overflow_result, "should equal exactly INT32_MAX");
+ doAssert(TRUE, uprv_add32_overflow(INT32_MAX - 2, 3, &overflow_result), "should overflow");
+ doAssert(FALSE, uprv_mul32_overflow(INT32_MAX / 5, 4, &overflow_result), "should not overflow");
+ doAssert(INT32_MAX / 5 * 4, overflow_result, "should equal INT32_MAX / 5 * 4");
+ doAssert(TRUE, uprv_mul32_overflow(INT32_MAX / 5, 6, &overflow_result), "should overflow");
+ // Test on negative numbers:
+ doAssert(FALSE, uprv_add32_overflow(-3, -2, &overflow_result), "should not overflow");
+ doAssert(-5, overflow_result, "should equal -5");
+
#if 0
log_verbose("Testing the API uprv_digitsAfterDecimal()....\n");
doAssert(uprv_digitsAfterDecimal(value1), 3, "uprv_digitsAfterDecimal() failed.");
--
2.24.1

View File

@ -0,0 +1,103 @@
diff -ru icu/source/common/unistr.cpp icu.new/source/common/unistr.cpp
--- icu/source/common/unistr.cpp 2019-04-12 00:26:16.000000000 +0200
+++ icu.new/source/common/unistr.cpp 2020-03-03 15:39:37.069874709 +0100
@@ -1544,7 +1544,11 @@
}
int32_t oldLength = length();
- int32_t newLength = oldLength + srcLength;
+ int32_t newLength;
+ if (uprv_add32_overflow(oldLength, srcLength, &newLength)) {
+ setToBogus();
+ return *this;
+ }
// optimize append() onto a large-enough, owned string
if((newLength <= getCapacity() && isBufferWritable()) ||
cloneArrayIfNeeded(newLength, getGrowCapacity(newLength))) {
diff -ru icu/source/test/intltest/ustrtest.cpp icu.new/source/test/intltest/ustrtest.cpp
--- icu/source/test/intltest/ustrtest.cpp 2019-04-12 00:26:16.000000000 +0200
+++ icu.new/source/test/intltest/ustrtest.cpp 2020-03-03 15:44:59.059239188 +0100
@@ -64,6 +64,7 @@
TESTCASE_AUTO(TestUInt16Pointers);
TESTCASE_AUTO(TestWCharPointers);
TESTCASE_AUTO(TestNullPointers);
+ TESTCASE_AUTO(TestLargeAppend);
TESTCASE_AUTO_END;
}
@@ -2248,3 +2249,64 @@
UnicodeString(u"def").extract(nullptr, 0, errorCode);
assertEquals("buffer overflow extracting to nullptr", U_BUFFER_OVERFLOW_ERROR, errorCode);
}
+
+void UnicodeStringTest::TestLargeAppend() {
+ if(quick) return;
+
+ IcuTestErrorCode status(*this, "TestLargeAppend");
+ // Make a large UnicodeString
+ int32_t len = 0xAFFFFFF;
+ UnicodeString str;
+ char16_t *buf = str.getBuffer(len);
+ // A fast way to set buffer to valid Unicode.
+ // 4E4E is a valid unicode character
+ uprv_memset(buf, 0x4e, len * 2);
+ str.releaseBuffer(len);
+ UnicodeString dest;
+ // Append it 16 times
+ // 0xAFFFFFF times 16 is 0xA4FFFFF1,
+ // which is greater than INT32_MAX, which is 0x7FFFFFFF.
+ int64_t total = 0;
+ for (int32_t i = 0; i < 16; i++) {
+ dest.append(str);
+ total += len;
+ if (total <= INT32_MAX) {
+ assertFalse("dest is not bogus", dest.isBogus());
+ } else {
+ assertTrue("dest should be bogus", dest.isBogus());
+ }
+ }
+ dest.remove();
+ total = 0;
+ for (int32_t i = 0; i < 16; i++) {
+ dest.append(str);
+ total += len;
+ if (total + len <= INT32_MAX) {
+ assertFalse("dest is not bogus", dest.isBogus());
+ } else if (total <= INT32_MAX) {
+ // Check that a string of exactly the maximum size works
+ UnicodeString str2;
+ int32_t remain = INT32_MAX - total;
+ char16_t *buf2 = str2.getBuffer(remain);
+ if (buf2 == nullptr) {
+ // if somehow memory allocation fail, return the test
+ return;
+ }
+ uprv_memset(buf2, 0x4e, remain * 2);
+ str2.releaseBuffer(remain);
+ dest.append(str2);
+ total += remain;
+ assertEquals("When a string of exactly the maximum size works", (int64_t)INT32_MAX, total);
+ assertEquals("When a string of exactly the maximum size works", INT32_MAX, dest.length());
+ assertFalse("dest is not bogus", dest.isBogus());
+
+ // Check that a string size+1 goes bogus
+ str2.truncate(1);
+ dest.append(str2);
+ total++;
+ assertTrue("dest should be bogus", dest.isBogus());
+ } else {
+ assertTrue("dest should be bogus", dest.isBogus());
+ }
+ }
+}
diff -ru icu/source/test/intltest/ustrtest.h icu.new/source/test/intltest/ustrtest.h
--- icu/source/test/intltest/ustrtest.h 2019-04-12 00:26:16.000000000 +0200
+++ icu.new/source/test/intltest/ustrtest.h 2020-03-03 15:45:36.147935611 +0100
@@ -96,6 +96,7 @@
void TestUInt16Pointers();
void TestWCharPointers();
void TestNullPointers();
+ void TestLargeAppend();
};
#endif

View File

@ -0,0 +1,96 @@
diff -ru orig.icu/source/test/cintltst/cnmdptst.c icu/source/test/cintltst/cnmdptst.c
--- orig.icu/source/test/cintltst/cnmdptst.c 2016-03-23 21:48:18.000000000 +0100
+++ icu/source/test/cintltst/cnmdptst.c 2016-04-15 18:34:06.148251985 +0200
@@ -186,6 +186,12 @@
/* Test exponential pattern*/
static void TestExponential(void)
{
+/* erAck: fails on armv7hl, https://bugzilla.redhat.com/show_bug.cgi?id=1239574 */
+#if 1
+ /* Actually only 3 tests fail, but given the nested structure depending on
+ * array sizes there's no simple "disable this and that". */
+ return;
+#endif
int32_t pat_length, val_length, lval_length;
int32_t ival, ilval, p, v, lneed;
UNumberFormat *fmt;
diff -ru orig.icu/source/test/intltest/dcfmtest.cpp icu/source/test/intltest/dcfmtest.cpp
--- orig.icu/source/test/intltest/dcfmtest.cpp 2016-03-23 21:48:38.000000000 +0100
+++ icu/source/test/intltest/dcfmtest.cpp 2016-04-15 18:34:06.148251985 +0200
@@ -279,6 +279,13 @@
//
formatLineMat.reset(testLine);
if (formatLineMat.lookingAt(status)) {
+/* erAck: fails on armv7hl, https://bugzilla.redhat.com/show_bug.cgi?id=1239574 */
+#if 1
+// [Formattable] file dcfmtest.txt, line 62: expected "12.35E5", got "1.235E6"
+// [StringPiece] file dcfmtest.txt, line 62: expected "12.35E5", got "1.235E6"
+ if (lineNum == 62)
+ continue;
+#endif
execFormatTest(lineNum,
formatLineMat.group(1, status), // Pattern
formatLineMat.group(2, status), // rounding mode
diff -ru orig.icu/source/test/intltest/numfmtspectest.cpp icu/source/test/intltest/numfmtspectest.cpp
--- orig.icu/source/test/intltest/numfmtspectest.cpp 2016-03-23 21:48:40.000000000 +0100
+++ icu/source/test/intltest/numfmtspectest.cpp 2016-04-15 18:34:06.148251985 +0200
@@ -137,11 +137,14 @@
void NumberFormatSpecificationTest::TestScientificNotation() {
assertPatternFr("1,23E4", 12345.0, "0.00E0", TRUE);
+/* erAck: fails on armv7hl, https://bugzilla.redhat.com/show_bug.cgi?id=1239574 */
+#if 0
assertPatternFr("123,00E2", 12300.0, "000.00E0", TRUE);
assertPatternFr("123,0E2", 12300.0, "000.0#E0", TRUE);
assertPatternFr("123,0E2", 12300.1, "000.0#E0", TRUE);
assertPatternFr("123,01E2", 12301.0, "000.0#E0", TRUE);
assertPatternFr("123,01E+02", 12301.0, "000.0#E+00", TRUE);
+#endif
assertPatternFr("12,3E3", 12345.0, "##0.00E0", TRUE);
assertPatternFr("12,300E3", 12300.1, "##0.0000E0", TRUE);
assertPatternFr("12,30E3", 12300.1, "##0.000#E0", TRUE);
@@ -221,6 +224,8 @@
assertEquals("", "USD (433.22)", result, TRUE);
}
}
+/* erAck: fails on armv7hl, https://bugzilla.redhat.com/show_bug.cgi?id=1239574 */
+#if 0
const char *paddedSciPattern = "QU**00.#####E0";
assertPatternFr("QU***43,3E-1", 4.33, paddedSciPattern, TRUE);
{
@@ -242,6 +247,7 @@
}
// padding cannot work as intended with scientific notation.
assertPatternFr("QU**43,32E-1", 4.332, paddedSciPattern, TRUE);
+#endif
}
void NumberFormatSpecificationTest::assertPatternFr(
diff -ru orig.icu/source/test/intltest/numfmtst.cpp icu/source/test/intltest/numfmtst.cpp
--- orig.icu/source/test/intltest/numfmtst.cpp 2016-03-23 21:48:40.000000000 +0100
+++ icu/source/test/intltest/numfmtst.cpp 2016-04-15 18:34:06.150251997 +0200
@@ -730,6 +730,12 @@
void
NumberFormatTest::TestExponential(void)
{
+/* erAck: fails on armv7hl, https://bugzilla.redhat.com/show_bug.cgi?id=1239574 */
+#if 1
+ /* Actually only 3 tests fail, but given the nested structure depending on
+ * array sizes there's no simple "disable this and that". */
+ return;
+#endif
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols sym(Locale::getUS(), status);
if (U_FAILURE(status)) { errcheckln(status, "FAIL: Bad status returned by DecimalFormatSymbols ct - %s", u_errorName(status)); return; }
@@ -1846,8 +1852,11 @@
(int32_t) 45678000, "5E7", status);
expect(new DecimalFormat("00E0", US, status),
(int32_t) 45678000, "46E6", status);
+/* erAck: fails on armv7hl, https://bugzilla.redhat.com/show_bug.cgi?id=1239574 */
+#if 0
expect(new DecimalFormat("000E0", US, status),
(int32_t) 45678000, "457E5", status);
+#endif
/*
expect(new DecimalFormat("###E0", US, status),
new Object[] { new Double(0.0000123), "12.3E-6",

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
OOO_ARCH=$(uname -m) OOO_ARCH=$(uname -m)
case $OOO_ARCH in case $OOO_ARCH in
x86_64 | s390x | ppc64 | sparc64 | aarch64 | ppc64le | mips64 | mips64el | riscv64) x86_64 | s390x | ppc64 | sparc64 | aarch64 | ppc64le | mips64 | mips64el)
bits=64 bits=64
;; ;;
* ) * )

171
SOURCES/icu-covscan.patch Normal file
View File

@ -0,0 +1,171 @@
diff -urN icu.old/source/common/uloc_keytype.cpp icu/source/common/uloc_keytype.cpp
--- icu.old/source/common/uloc_keytype.cpp 2017-02-01 01:21:30.000000000 +0530
+++ icu/source/common/uloc_keytype.cpp 2018-09-23 18:48:04.414990551 +0530
@@ -383,6 +383,7 @@
LocExtKeyData* keyData = (LocExtKeyData*)uprv_malloc(sizeof(LocExtKeyData));
if (keyData == NULL) {
sts = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(typeDataMap);
break;
}
keyData->bcpId = bcpKeyId;
diff -urN icu.old/source/common/uloc_tag.cpp icu/source/common/uloc_tag.cpp
--- icu.old/source/common/uloc_tag.cpp 2017-10-11 21:54:34.000000000 +0530
+++ icu/source/common/uloc_tag.cpp 2018-09-23 18:48:58.207182317 +0530
@@ -2145,6 +2145,7 @@
error:
ultag_close(t);
+ uprv_free(pExtension);
return NULL;
}
diff -urN icu.old/source/i18n/olsontz.cpp icu/source/i18n/olsontz.cpp
--- icu.old/source/i18n/olsontz.cpp 2017-02-01 01:21:27.000000000 +0530
+++ icu/source/i18n/olsontz.cpp 2018-09-23 18:52:02.140418739 +0530
@@ -787,6 +787,7 @@
if (historicRules[typeIdx] == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
deleteTransitionRules();
+ uprv_free(times);
return;
}
}
diff -urN icu.old/source/i18n/rbt_pars.cpp icu/source/i18n/rbt_pars.cpp
--- icu.old/source/i18n/rbt_pars.cpp 2017-02-01 01:21:27.000000000 +0530
+++ icu/source/i18n/rbt_pars.cpp 2018-09-23 18:52:51.362679180 +0530
@@ -557,6 +557,7 @@
// The next character MUST be a segment open
if (single == NULL ||
!ICU_Utility::parseChar(rule, iref, SEGMENT_OPEN)) {
+ uprv_free(single);
return syntaxError(U_INVALID_FUNCTION, rule, start, status);
}
diff -urN icu.old/source/i18n/tznames_impl.cpp icu/source/i18n/tznames_impl.cpp
--- icu.old/source/i18n/tznames_impl.cpp 2017-10-11 21:54:34.000000000 +0530
+++ icu/source/i18n/tznames_impl.cpp 2018-09-23 18:55:36.222152997 +0530
@@ -1762,6 +1762,7 @@
UResourceBundle* rbTable = NULL;
rbTable = ures_getByKey(rb, key, rbTable, &status);
if (U_FAILURE(status)) {
+ uprv_free(rbTable);
return NULL;
}
@@ -1784,6 +1785,7 @@
if (names != NULL) {
uprv_free(names);
}
+ uprv_free(rbTable);
return NULL;
}
diff -urN icu.old/source/i18n/usearch.cpp icu/source/i18n/usearch.cpp
--- icu.old/source/i18n/usearch.cpp 2017-02-01 01:21:27.000000000 +0530
+++ icu/source/i18n/usearch.cpp 2018-09-23 18:54:34.752103865 +0530
@@ -222,6 +222,7 @@
int32_t *temp = (int32_t *)allocateMemory(
sizeof(int32_t) * newlength, status);
if (U_FAILURE(*status)) {
+ uprv_free(temp);
return NULL;
}
uprv_memcpy(temp, destination, sizeof(int32_t) * (size_t)offset);
@@ -263,6 +264,7 @@
sizeof(int64_t) * newlength, status);
if (U_FAILURE(*status)) {
+ uprv_free(temp);
return NULL;
}
diff -urN icu.old/source/tools/ctestfw/ctest.c icu/source/tools/ctestfw/ctest.c
--- icu.old/source/tools/ctestfw/ctest.c 2017-02-01 01:21:30.000000000 +0530
+++ icu/source/tools/ctestfw/ctest.c 2018-09-23 18:19:43.612734248 +0530
@@ -803,6 +803,7 @@
}
va_start(ap, pattern);
vlog_err(NULL, pattern, ap);
+ va_end(ap);
}
UBool T_CTEST_EXPORT2
@@ -810,6 +811,7 @@
va_list ap;
va_start(ap, pattern);
return vlog_knownIssue(ticket, pattern, ap);
+ va_end(ap);
}
void T_CTEST_EXPORT2
@@ -843,6 +845,7 @@
}
vlog_err(NULL, pattern, ap); /* no need for prefix in default case */
}
+ va_end(ap);
}
void T_CTEST_EXPORT2
@@ -852,6 +855,7 @@
va_start(ap, pattern);
vlog_info(NULL, pattern, ap);
+ va_end(ap);
}
void T_CTEST_EXPORT2
@@ -861,6 +865,7 @@
va_start(ap, pattern);
vlog_verbose(NULL, pattern, ap);
+ va_end(ap);
}
@@ -882,6 +887,7 @@
} else {
vlog_info("[DATA] ", pattern, ap);
}
+ va_end(ap);
}
diff -urN icu.old/source/tools/gensprep/store.c icu/source/tools/gensprep/store.c
--- icu.old/source/tools/gensprep/store.c 2017-02-08 00:27:35.000000000 +0530
+++ icu/source/tools/gensprep/store.c 2018-09-23 17:42:52.262908882 +0530
@@ -634,7 +634,6 @@
cleanUpData(void) {
uprv_free(mappingData);
utrie_close(sprepTrie);
- uprv_free(sprepTrie);
}
#endif /* #if !UCONFIG_NO_IDNA */
diff -urN icu.old/source/tools/pkgdata/pkgdata.cpp icu/source/tools/pkgdata/pkgdata.cpp
--- icu.old/source/tools/pkgdata/pkgdata.cpp 2017-03-23 04:56:34.000000000 +0530
+++ icu/source/tools/pkgdata/pkgdata.cpp 2018-09-23 17:40:19.730240502 +0530
@@ -1531,11 +1531,11 @@
gencFilePath);
result = runCommand(cmd);
- uprv_free(cmd);
if (result != 0) {
fprintf(stderr, "Error creating with assembly code. Failed command: %s\n", cmd);
return result;
}
+ uprv_free(cmd);
return pkg_generateLibraryFile(targetDir, mode, tempObjectFile);
}
diff -urN icu.old/source/tools/toolutil/filetools.cpp icu/source/tools/toolutil/filetools.cpp
--- icu.old/source/tools/toolutil/filetools.cpp 2017-02-01 01:21:30.000000000 +0530
+++ icu/source/tools/toolutil/filetools.cpp 2018-09-23 16:09:47.949491516 +0530
@@ -64,6 +64,7 @@
newpath.append(dirEntry->d_name, -1, status);
if (U_FAILURE(status)) {
fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, u_errorName(status));
+ free(pDir);
return FALSE;
};

View File

@ -0,0 +1,154 @@
Index: icu4c/source/test/intltest/tzregts.cpp
===================================================================
--- icu4c/source/test/intltest/tzregts.cpp (リビジョン 40953)
+++ icu4c/source/test/intltest/tzregts.cpp (リビジョン 40954)
@@ -12,6 +12,7 @@
#include "unicode/simpletz.h"
#include "unicode/smpdtfmt.h"
#include "unicode/strenum.h"
+#include "unicode/gregocal.h"
#include "tzregts.h"
#include "calregts.h"
#include "cmemory.h"
@@ -46,6 +47,7 @@
CASE(16, TestJDK12API);
CASE(17, Test4176686);
CASE(18, Test4184229);
+ CASE(19, TestNegativeDaylightSaving);
default: name = ""; break;
}
}
@@ -709,10 +711,10 @@
int32_t DATA [] = {
1, GOOD,
0, BAD,
- -1, BAD,
+ -1, GOOD, // #13566 updates SimpleTimeZone to support negative DST saving amount
60*60*1000, GOOD,
- INT32_MIN, BAD,
- // Integer.MAX_VALUE, ?, // no upper limit on DST savings at this time
+ INT32_MAX, GOOD, // no upper limit on DST savings at this time
+ INT32_MIN, GOOD // no lower limit as well
};
UErrorCode status = U_ZERO_ERROR;
@@ -1206,4 +1208,61 @@
delete zone;
}
+void TimeZoneRegressionTest::TestNegativeDaylightSaving() {
+ UErrorCode status = U_ZERO_ERROR;
+ int32_t stdOff = 1 * 60*60*1000; // Standard offset UTC+1
+ int save = -1 * 60*60*1000; // DST saving amount -1 hour
+ SimpleTimeZone stzDublin(stdOff, "Dublin-2018",
+ UCAL_OCTOBER, -1, -UCAL_SUNDAY, 2*60*60*1000,
+ UCAL_MARCH, -1, -UCAL_SUNDAY, 1*60*60*1000,
+ save, status);
+ failure(status, "SimpleTimeZone constructor");
+
+ if (save != stzDublin.getDSTSavings()) {
+ errln((UnicodeString)"FAIL: DST saving is not " + save);
+ }
+
+ GregorianCalendar cal(* TimeZone::getGMT(), status);
+ failure(status, "GregorianCalendar constructor");
+
+ UDate testDate;
+ int32_t rawOffset;
+ int32_t dstOffset;
+
+ cal.set(2018, UCAL_JANUARY, 15, 0, 0, 0);
+ testDate = cal.getTime(status);
+ failure(status, "calendar getTime() - Jan 15");
+
+ if (!stzDublin.inDaylightTime(testDate, status)) {
+ errln("FAIL: The test date (Jan 15) must be in DST.");
+ }
+ failure(status, "inDaylightTime() - Jan 15");
+
+ stzDublin.getOffset(testDate, FALSE, rawOffset, dstOffset, status);
+ failure(status, "getOffset() - Jan 15");
+ if (rawOffset != stdOff || dstOffset != save) {
+ errln((UnicodeString)"FAIL: Expected [stdoff=" + stdOff + ",save=" + save
+ + "] on the test date (Jan 15), actual[stdoff=" + rawOffset
+ + ",save=" + dstOffset + "]");
+ }
+
+ cal.set(2018, UCAL_JULY, 15, 0, 0, 0);
+ testDate = cal.getTime(status);
+ failure(status, "calendar getTime() - Jul 15");
+
+ if (stzDublin.inDaylightTime(testDate, status)) {
+ errln("FAIL: The test date (Jul 15) must be in DST.");
+ }
+ failure(status, "inDaylightTime() - Jul 15");
+
+ stzDublin.getOffset(testDate, FALSE, rawOffset, dstOffset, status);
+ failure(status, "getOffset() - Jul 15");
+ if (rawOffset != stdOff || dstOffset != 0) {
+ errln((UnicodeString)"FAIL: Expected [stdoff=" + stdOff + ",save=" + 0
+ + "] on the test date (Jul 15), actual[stdoff=" + rawOffset
+ + ",save=" + dstOffset + "]");
+ }
+}
+
+
#endif /* #if !UCONFIG_NO_FORMATTING */
Index: icu4c/source/test/intltest/tzregts.h
===================================================================
--- icu4c/source/test/intltest/tzregts.h (リビジョン 40953)
+++ icu4c/source/test/intltest/tzregts.h (リビジョン 40954)
@@ -49,6 +49,7 @@
void TestJDK12API(void);
void Test4184229(void);
UBool checkCalendar314(GregorianCalendar *testCal, TimeZone *testTZ);
+ void TestNegativeDaylightSaving(void);
protected:
Index: icu4c/source/i18n/simpletz.cpp
===================================================================
--- icu4c/source/i18n/simpletz.cpp (リビジョン 40953)
+++ icu4c/source/i18n/simpletz.cpp (リビジョン 40954)
@@ -177,7 +177,7 @@
decodeRules(status);
- if (savingsDST <= 0) {
+ if (savingsDST == 0) {
status = U_ILLEGAL_ARGUMENT_ERROR;
}
}
@@ -686,7 +686,7 @@
void
SimpleTimeZone::setDSTSavings(int32_t millisSavedDuringDST, UErrorCode& status)
{
- if (millisSavedDuringDST <= 0) {
+ if (millisSavedDuringDST == 0) {
status = U_ILLEGAL_ARGUMENT_ERROR;
}
else {
Index: icu4c/source/i18n/unicode/simpletz.h
===================================================================
--- icu4c/source/i18n/unicode/simpletz.h (リビジョン 40953)
+++ icu4c/source/i18n/unicode/simpletz.h (リビジョン 40954)
@@ -647,7 +647,8 @@
* Sets the amount of time in ms that the clock is advanced during DST.
* @param millisSavedDuringDST the number of milliseconds the time is
* advanced with respect to standard time when the daylight savings rules
- * are in effect. A positive number, typically one hour (3600000).
+ * are in effect. Typically one hour (+3600000). The amount could be negative,
+ * but not 0.
* @param status An UErrorCode to receive the status.
* @stable ICU 2.0
*/
@@ -657,7 +658,8 @@
* Returns the amount of time in ms that the clock is advanced during DST.
* @return the number of milliseconds the time is
* advanced with respect to standard time when the daylight savings rules
- * are in effect. A positive number, typically one hour (3600000).
+ * are in effect. Typically one hour (+3600000). The amount could be negative,
+ * but not 0.
* @stable ICU 2.0
*/
virtual int32_t getDSTSavings(void) const;

View File

@ -1,37 +1,27 @@
#%%global debugtrace 1 #%%global debugtrace 1
# Set to 0 when upgrading to a new ICU release that contains up-to-date timezone data.
# (or update the timezone data update..).
%global use_tzdata_update 0
%define version_dash %{gsub %{version} %. -}
%define version_underscore %{gsub %{version} %. _}
Name: icu Name: icu
Version: 74.2 Version: 60.3
Release: 2%{?dist} Release: 2%{?dist}
Summary: International Components for Unicode Summary: International Components for Unicode
License: Unicode-DFS-2016 AND BSD-2-Clause AND BSD-3-Clause AND LicenseRef-Fedora-Public-Domain License: MIT and UCD and Public Domain
URL: http://site.icu-project.org/ URL: http://site.icu-project.org/
Source0: https://github.com/unicode-org/icu/releases/download/release-%{version_dash}/icu4c-%{version_underscore}-src-FIXED.tgz Source0: https://github.com/unicode-org/icu/releases/download/release-60-3/icu4c-60_3-src.tgz
%if 0%{?use_tzdata_update} Source1: icu-config.sh
Source1: https://github.com/unicode-org/icu/releases/download/release-%{version_dash}/icu4c-%{version_underscore}-data.zip
Source2: https://raw.githubusercontent.com/unicode-org/icu-data/main/tzdata/icunew/2022b/44/metaZones.txt
Source3: https://raw.githubusercontent.com/unicode-org/icu-data/main/tzdata/icunew/2022b/44/timezoneTypes.txt
Source4: https://raw.githubusercontent.com/unicode-org/icu-data/main/tzdata/icunew/2022b/44/windowsZones.txt
Source5: https://raw.githubusercontent.com/unicode-org/icu-data/main/tzdata/icunew/2022b/44/zoneinfo64.txt
%endif
Source10: icu-config.sh
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: doxygen, autoconf, python3 BuildRequires: doxygen, autoconf, python3
BuildRequires: make
Requires: lib%{name}%{?_isa} = %{version}-%{release} Requires: lib%{name}%{?_isa} = %{version}-%{release}
Patch4: gennorm2-man.patch Patch4: gennorm2-man.patch
Patch5: icuinfo-man.patch Patch5: icuinfo-man.patch
Patch6: negative-daylight-savings.patch
Patch100: armv7hl-disable-tests.patch
Patch101: icu-covscan.patch
Patch200: ICU-13634-Adding-integer-overflow-logic-to-ICU4C-num.patch
Patch201: ICU-20958-Prevent-SEGV_MAPERR-in-append.patch
%description %description
Tools and utilities for developing with icu. Tools and utilities for developing with icu.
@ -71,14 +61,16 @@ BuildArch: noarch
%prep %prep
%autosetup -p1 -n %{name} %setup -q -n %{name}
%if 0%{?use_tzdata_update} %patch4 -p1 -b .gennorm2-man.patch
pushd source %patch5 -p1 -b .icuinfo-man.patch
unzip -o %{SOURCE1} %patch6 -p1 -b .negative-daylight-savings.patch
rm -f data/in/icudt*l.dat %ifarch armv7hl
cp -v -f %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} data/misc %patch100 -p1 -b .armv7hl-disable-tests.patch
popd
%endif %endif
%patch101 -p1 -b .covscan
%patch200 -p2 -b .ICU-13634
%patch201 -p1 -b .ICU-20958
%build %build
pushd source pushd source
@ -95,7 +87,7 @@ OPTIONS='--with-data-packaging=library --disable-samples'
%if 0%{?debugtrace} %if 0%{?debugtrace}
OPTIONS=$OPTIONS' --enable-debug --enable-tracing' OPTIONS=$OPTIONS' --enable-debug --enable-tracing'
%endif %endif
%configure $OPTIONS %configure $OPTIONS CC=gcc CXX=g++
#rhbz#225896 #rhbz#225896
sed -i 's|-nodefaultlibs -nostdlib||' config/mh-linux sed -i 's|-nodefaultlibs -nostdlib||' config/mh-linux
@ -111,20 +103,20 @@ test -f uconfig.h.prepend && sed -e '/^#define __UCONFIG_H__/ r uconfig.h.prepen
# more verbosity for build.log # more verbosity for build.log
sed -i -r 's|(PKGDATA_OPTS = )|\1-v |' data/Makefile sed -i -r 's|(PKGDATA_OPTS = )|\1-v |' data/Makefile
%make_build make %{?_smp_mflags} VERBOSE=1
%make_build doc make %{?_smp_mflags} doc
%install %install
rm -rf $RPM_BUILD_ROOT source/__docs rm -rf $RPM_BUILD_ROOT source/__docs
%make_install %{?_smp_mflags} -C source make %{?_smp_mflags} -C source install DESTDIR=$RPM_BUILD_ROOT
make %{?_smp_mflags} -C source install-doc docdir=__docs make %{?_smp_mflags} -C source install-doc docdir=__docs
chmod +x $RPM_BUILD_ROOT%{_libdir}/*.so.* chmod +x $RPM_BUILD_ROOT%{_libdir}/*.so.*
( (
cd $RPM_BUILD_ROOT%{_bindir} cd $RPM_BUILD_ROOT%{_bindir}
mv icu-config icu-config-%{__isa_bits} mv icu-config icu-config-%{__isa_bits}
) )
install -p -m755 -D %{SOURCE10} $RPM_BUILD_ROOT%{_bindir}/icu-config install -p -m755 -D %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/icu-config
%check %check
@ -132,13 +124,23 @@ install -p -m755 -D %{SOURCE10} $RPM_BUILD_ROOT%{_bindir}/icu-config
if grep -q @VERSION@ source/tools/*/*.8 source/tools/*/*.1 source/config/*.1; then if grep -q @VERSION@ source/tools/*/*.8 source/tools/*/*.1 source/config/*.1; then
exit 1 exit 1
fi fi
%make_build -C source check %ifarch i686
# F26 since the mass rebuild in 2017-Feb fails a check, ignore error. TODO: find cause / disable only one.
make %{?_smp_mflags} -C source check ||:
%else
make %{?_smp_mflags} -C source check
%endif
# log available codes # log available codes
pushd source pushd source
LD_LIBRARY_PATH=lib:stubdata:tools/ctestfw:$LD_LIBRARY_PATH bin/uconv -l LD_LIBRARY_PATH=lib:stubdata:tools/ctestfw:$LD_LIBRARY_PATH bin/uconv -l
%post -n lib%{name} -p /sbin/ldconfig
%postun -n lib%{name} -p /sbin/ldconfig
%files %files
%license license.html %license license.html
%exclude %{_datadir}/%{name}/*/LICENSE %exclude %{_datadir}/%{name}/*/LICENSE
@ -148,18 +150,16 @@ LD_LIBRARY_PATH=lib:stubdata:tools/ctestfw:$LD_LIBRARY_PATH bin/uconv -l
%{_bindir}/gencnval %{_bindir}/gencnval
%{_bindir}/gendict %{_bindir}/gendict
%{_bindir}/genrb %{_bindir}/genrb
%{_bindir}/icuexportdata
%{_bindir}/makeconv %{_bindir}/makeconv
%{_bindir}/pkgdata %{_bindir}/pkgdata
%{_bindir}/uconv %{_bindir}/uconv
%{_sbindir}/* %{_sbindir}/*
%{_mandir}/man1/derb.1* %{_mandir}/man1/derb.1*
%{_mandir}/man1/genbrk.1*
%{_mandir}/man1/gencfu.1* %{_mandir}/man1/gencfu.1*
%{_mandir}/man1/gencnval.1* %{_mandir}/man1/gencnval.1*
%{_mandir}/man1/gendict.1* %{_mandir}/man1/gendict.1*
%{_mandir}/man1/genrb.1* %{_mandir}/man1/genrb.1*
%{_mandir}/man1/icuexportdata.1* %{_mandir}/man1/genbrk.1*
%{_mandir}/man1/makeconv.1* %{_mandir}/man1/makeconv.1*
%{_mandir}/man1/pkgdata.1* %{_mandir}/man1/pkgdata.1*
%{_mandir}/man1/uconv.1* %{_mandir}/man1/uconv.1*
@ -194,129 +194,31 @@ LD_LIBRARY_PATH=lib:stubdata:tools/ctestfw:$LD_LIBRARY_PATH bin/uconv -l
%changelog %changelog
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 74.2-2 * Tue Mar 03 2020 Mike FABIAN <mfabian@redhat.com> - 60.3-2
- Bump release for June 2024 mass rebuild - Apply ICU-13634-Adding-integer-overflow-logic-to-ICU4C-num.patch
- Apply ICU-20958-Prevent-SEGV_MAPERR-in-append.patch
- Resolves: rhbz#1808238
* Wed Jan 31 2024 Pete Walter <pwalter@fedoraproject.org> - 74.2-1 * Tue May 07 2019 Mike FABIAN <mfabian@redhat.com> - 60.3-1
- Update to 74.2 - Update to 60.3 maintenance release including support for new Japanese era Reiwa (令和).
- Resolves: rhbz#1677093
* Mon Jan 29 2024 Pete Walter <pwalter@fedoraproject.org> - 74.1-1 * Thu Nov 15 2018 Parag Nemade <pnemade AT redhat DOT com> - 60.2-7
- Update to 74.1 - Resolves:rh#1602551 - Fix specfile by adding compile options
- also add BuildRequires for gcc and gcc-c++
- Correct the upstream URL
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 73.2-5 * Sun Sep 23 2018 Parag Nemade <pnemade AT redhat DOT com> - 60.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - Resolves:rh#1602551 - Fix some covscan issues
* Sat Jan 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 73.2-4 * Thu Jun 28 2018 Mike FABIAN <mfabian@redhat.com> - 60.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - Drop Python2 build dependency, use Python3 instead
- Resolves: rhbz#1595790
* Wed Dec 13 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 73.2-3 * Thu May 31 2018 Mike FABIAN <mfabian@redhat.com> - 60.2-4
- Fix broken TestHebrewCalendarInTemporalLeapYear - Add negative-daylight-savings.patch from upstream.
(see http://bugs.icu-project.org/trac/ticket/13566 and
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 73.2-2 http://bugs.icu-project.org/trac/changeset/40954)
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jul 06 2023 Frantisek Zatloukal <fzatlouk@redhat.com> - 73.2-1
- Update to 73.2
* Fri Jan 20 2023 Eike Rathke <erack@redhat.com> - 72.1-3
- migrated to SPDX license IDs
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 72.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Dec 28 2022 Pete Walter <pwalter@fedoraproject.org> - 72.1-1
- Update to 72.1
* Fri Sep 23 2022 Mike FABIAN <mfabian@redhat.com> - 71.1-2
- Update timezone data to 2022b
* Wed Jul 27 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 71.1-1
- Update to 71.1
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 69.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu May 05 2022 Mike FABIAN <mfabian@redhat.com> - 69.1-6
- Update timezone data to 2022a
* Wed Feb 02 2022 Eike Rathke <erack@redhat.com> - 69.1-5
- Introduce use_tzdata_update flag
* Tue Feb 01 2022 Mike FABIAN <mfabian@redhat.com> - 69.1-4
- Update timezone data to 2021a4
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 69.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 69.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed May 19 2021 Pete Walter <pwalter@fedoraproject.org> - 69.1-1
- Update to 69.1
* Tue Mar 30 2021 Jonathan Wakely <jwakely@redhat.com> - 67.1-6
- Rebuilt for removed libstdc++ symbol (#1937698)
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 67.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 67.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 21 2020 Eike Rathke <erack@redhat.com> - 67.1-3
- Replace unversioned %%{__python} macro with %%{__python3}
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 67.1-2
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Fri May 15 2020 Pete Walter <pwalter@fedoraproject.org> - 67.1-1
- Update to 67.1
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 65.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Nov 01 2019 Pete Walter <pwalter@fedoraproject.org> - 65.1-1
- Update to 65.1
- Add a patch from gentoo to fix the build on s390x
- Drop arm test disabling patches as they are no longer needed
* Fri Nov 01 2019 Pete Walter <pwalter@fedoraproject.org> - 63.2-4
- Build with Python 3
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 63.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon May 13 2019 Eike Rathke <erack@redhat.com> - 63.2-2
- Resolves: rhbz#1708935 temporarily roll back to 63.1
* Thu May 09 2019 Eike Rathke <erack@redhat.com> - 63.2-1
- Update to 63.2
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 63.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Jan 23 2019 Pete Walter <pwalter@fedoraproject.org> - 63.1-1
- Update to 63.1
* Tue Nov 06 2018 Eike Rathke <erack@redhat.com> - 62.1-3
- Resolves: rhbz#1646703 CVE-2018-18928
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 62.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jul 10 2018 Pete Walter <pwalter@fedoraproject.org> - 62.1-1
- Update to 62.1
* Mon May 28 2018 Eike Rathke <erack@redhat.com> - 61.1-2
- Resolves: rhbz#1582611 Add riscv64 to icu-config.sh
* Tue Apr 24 2018 Eike Rathke <erack@redhat.com> - 61.1-1
- Update to 61.1
* Thu Mar 15 2018 Iryna Shcherbina <ishcherb@redhat.com> - 60.2-3
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 60.2-2 * Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 60.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

View File

@ -1 +0,0 @@
SHA512 (icu4c-74_2-src-FIXED.tgz) = e6c7876c0f3d756f3a6969cad9a8909e535eeaac352f3a721338b9cbd56864bf7414469d29ec843462997815d2ca9d0dab06d38c37cdd4d8feb28ad04d8781b0