diff options
Diffstat (limited to 'deps/icu-small/source/i18n/coll.cpp')
-rw-r--r-- | deps/icu-small/source/i18n/coll.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/deps/icu-small/source/i18n/coll.cpp b/deps/icu-small/source/i18n/coll.cpp index b7348a1d16..2a614fac5d 100644 --- a/deps/icu-small/source/i18n/coll.cpp +++ b/deps/icu-small/source/i18n/coll.cpp @@ -448,6 +448,13 @@ Collator* U_EXPORT2 Collator::createInstance(const Locale& desiredLocale, #endif { coll = makeInstance(desiredLocale, status); + // Either returns NULL with U_FAILURE(status), or non-NULL with U_SUCCESS(status) + } + // The use of *coll in setAttributesFromKeywords can cause the NULL check to be + // optimized out of the delete even though setAttributesFromKeywords returns + // immediately if U_FAILURE(status), so we add a check here. + if (U_FAILURE(status)) { + return NULL; } setAttributesFromKeywords(desiredLocale, *coll, status); if (U_FAILURE(status)) { @@ -986,8 +993,8 @@ Collator::internalCompareUTF8(const char *left, int32_t leftLength, return UCOL_EQUAL; } return compareUTF8( - StringPiece(left, (leftLength < 0) ? uprv_strlen(left) : leftLength), - StringPiece(right, (rightLength < 0) ? uprv_strlen(right) : rightLength), + StringPiece(left, (leftLength < 0) ? static_cast<int32_t>(uprv_strlen(left)) : leftLength), + StringPiece(right, (rightLength < 0) ? static_cast<int32_t>(uprv_strlen(right)) : rightLength), errorCode); } |