summaryrefslogtreecommitdiff
path: root/src/third_party/icu4c-57.1
diff options
context:
space:
mode:
authorNick Zolnierz <nicholas.zolnierz@mongodb.com>2018-12-17 09:33:27 -0500
committerNick Zolnierz <nicholas.zolnierz@mongodb.com>2018-12-17 09:33:35 -0500
commit89d073b2443f48e4a9913c298998a16c27b438a5 (patch)
tree6fa707d1e2be3945b626f59c4561359b4e42c172 /src/third_party/icu4c-57.1
parentba3894493a94ed3c18458f391ff181d57475f010 (diff)
downloadmongo-89d073b2443f48e4a9913c298998a16c27b438a5.tar.gz
SERVER-38348 Null pointer dereference in ICU library
Diffstat (limited to 'src/third_party/icu4c-57.1')
-rw-r--r--src/third_party/icu4c-57.1/source/i18n/coll.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/third_party/icu4c-57.1/source/i18n/coll.cpp b/src/third_party/icu4c-57.1/source/i18n/coll.cpp
index cb10f23696b..5eeea65dfa0 100644
--- a/src/third_party/icu4c-57.1/source/i18n/coll.cpp
+++ b/src/third_party/icu4c-57.1/source/i18n/coll.cpp
@@ -444,6 +444,17 @@ 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)
+ }
+
+ // MONGODB MODIFICATION
+ // Fix for SERVER-38348 by applying
+ // https://github.com/unicode-org/icu/commit/643e8756c8f8d2a7f2ffe306467e28a9896d7986.
+ // The use of *coll in setAttributesFromKeywords can cause causes 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)) {