component(developer/golang-123): Add Component
[oi-userland.git] / components / library / icu / patches / 092-source-i18n-zonemeta.cpp.patch
blob3963e9f2254b2fac77d3ceb09eb7ec374f617571
2 # Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
4 Add NULL checks for TimeZone::createTimeZoneIDEnumeration calls
5 https://unicode-org.atlassian.net/browse/ICU-12377
7 --- icu/source/i18n/dtfmtsym.cpp.orig
8 +++ icu/source/i18n/dtfmtsym.cpp
9 @@ -1299,6 +1299,10 @@
10 do { // dummy do-while
12 tzids = TimeZone::createTimeZoneIDEnumeration(ZONE_SET, nullptr, nullptr, status);
13 + if (tzids == nullptr) {
14 + status = U_MEMORY_ALLOCATION_ERROR;
15 + break;
16 + }
17 rows = tzids->count(status);
18 if (U_FAILURE(status)) {
19 break;
20 --- icu/source/i18n/zonemeta.cpp.orig
21 +++ icu/source/i18n/zonemeta.cpp
22 @@ -486,12 +486,14 @@
23 u_UCharsToChars(region, regionBuf, 2);
25 StringEnumeration *ids = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL_LOCATION, regionBuf, nullptr, status);
26 - int32_t idsLen = ids->count(status);
27 - if (U_SUCCESS(status) && idsLen == 1) {
28 - // only the single zone is available for the region
29 - singleZone = true;
30 + if (ids != nullptr) {
31 + int32_t idsLen = ids->count(status);
32 + if (U_SUCCESS(status) && idsLen == 1) {
33 + // only the single zone is available for the region
34 + singleZone = true;
35 + }
36 + delete ids;
38 - delete ids;
40 // Cache the result
41 umtx_lock(&gZoneMetaLock);