summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-03 14:07:51 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-05 09:48:04 +0000
commitfb4add52f73ccd26934e76615eed7a96dce42b23 (patch)
tree53062b8c3650161ea15b09722a7454bc7b553d1b
parentf2ffe010d92607c5eebbabf306d57e4eedb05750 (diff)
downloadqtwebengine-chromium-fb4add52f73ccd26934e76615eed7a96dce42b23.tar.gz
[Backport] Cherry-pick the entire fix for Persian calendar
The upstream CL is at https://ssl.icu-project.org/trac/changeset/40654 . Previously, only a part was cherry-picked. Bug: 774382 (CVE-2017-15422) Change-Id: Ia8155248313fe0cfa4e82c2b3ac7280ff622b871 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
-rw-r--r--chromium/third_party/icu/README.chromium1
-rw-r--r--chromium/third_party/icu/source/i18n/gregoimp.cpp5
-rw-r--r--chromium/third_party/icu/source/i18n/gregoimp.h11
3 files changed, 17 insertions, 0 deletions
diff --git a/chromium/third_party/icu/README.chromium b/chromium/third_party/icu/README.chromium
index 975868d39ea..44e0600316a 100644
--- a/chromium/third_party/icu/README.chromium
+++ b/chromium/third_party/icu/README.chromium
@@ -310,6 +310,7 @@ D. Local Modifications
13. Persian calendar range fix.
+ https://ssl.icu-project.org/trac/changeset/40654
http://crbug.com/774382
- patches/persian_cal.patch (fixed in ICU 60.1)
diff --git a/chromium/third_party/icu/source/i18n/gregoimp.cpp b/chromium/third_party/icu/source/i18n/gregoimp.cpp
index e62044b361a..537aa19d8a4 100644
--- a/chromium/third_party/icu/source/i18n/gregoimp.cpp
+++ b/chromium/third_party/icu/source/i18n/gregoimp.cpp
@@ -27,6 +27,11 @@ int32_t ClockMath::floorDivide(int32_t numerator, int32_t denominator) {
numerator / denominator : ((numerator + 1) / denominator) - 1;
}
+int64_t ClockMath::floorDivide(int64_t numerator, int64_t denominator) {
+ return (numerator >= 0) ?
+ numerator / denominator : ((numerator + 1) / denominator) - 1;
+}
+
int32_t ClockMath::floorDivide(double numerator, int32_t denominator,
int32_t& remainder) {
double quotient;
diff --git a/chromium/third_party/icu/source/i18n/gregoimp.h b/chromium/third_party/icu/source/i18n/gregoimp.h
index b30741679df..afaacda0b41 100644
--- a/chromium/third_party/icu/source/i18n/gregoimp.h
+++ b/chromium/third_party/icu/source/i18n/gregoimp.h
@@ -41,6 +41,17 @@ class ClockMath {
static int32_t floorDivide(int32_t numerator, int32_t denominator);
/**
+ * Divide two integers, returning the floor of the quotient.
+ * Unlike the built-in division, this is mathematically
+ * well-behaved. E.g., <code>-1/4</code> => 0 but
+ * <code>floorDivide(-1,4)</code> => -1.
+ * @param numerator the numerator
+ * @param denominator a divisor which must be != 0
+ * @return the floor of the quotient
+ */
+ static int64_t floorDivide(int64_t numerator, int64_t denominator);
+
+ /**
* Divide two numbers, returning the floor of the quotient.
* Unlike the built-in division, this is mathematically
* well-behaved. E.g., <code>-1/4</code> => 0 but