diff options
author | romankoshelev <romankoshelev@yandex-team.com> | 2023-08-09 20:07:20 +0300 |
---|---|---|
committer | romankoshelev <romankoshelev@yandex-team.com> | 2023-08-09 20:59:13 +0300 |
commit | fd82fb12fb45e71a02c628e45b12c50c0dd0d308 (patch) | |
tree | f582b79f9002ab1d083e9acda600dfb3551c47b6 /contrib/libs/icu/i18n/translit.cpp | |
parent | bf862ddf5c6178e1bb5e4fb3f7c61015deebe284 (diff) | |
download | ydb-fd82fb12fb45e71a02c628e45b12c50c0dd0d308.tar.gz |
Update ICU to 70.1
Diffstat (limited to 'contrib/libs/icu/i18n/translit.cpp')
-rw-r--r-- | contrib/libs/icu/i18n/translit.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/contrib/libs/icu/i18n/translit.cpp b/contrib/libs/icu/i18n/translit.cpp index ef44f42aa6..c7d6b51057 100644 --- a/contrib/libs/icu/i18n/translit.cpp +++ b/contrib/libs/icu/i18n/translit.cpp @@ -170,6 +170,7 @@ Transliterator* Transliterator::clone() const { * Assignment operator. */ Transliterator& Transliterator::operator=(const Transliterator& other) { + if (this == &other) { return *this; } // self-assignment: no-op ID = other.ID; // NUL-terminate the ID string ID.getTerminatedBuffer(); @@ -1092,6 +1093,8 @@ Transliterator::createFromRules(const UnicodeString& ID, } else { UVector transliterators(status); + // TODO ICU-21701 missing U_FAILURE check here. + // Error and nullptr checking through this whole block looks suspect. int32_t passNumber = 1; int32_t limit = parser.idBlockVector.size(); @@ -1107,10 +1110,15 @@ Transliterator::createFromRules(const UnicodeString& ID, delete temp; return nullptr; } - if (temp != NULL && typeid(*temp) != typeid(NullTransliterator)) + if (temp != NULL && typeid(*temp) != typeid(NullTransliterator)) { transliterators.addElement(temp, status); - else + if (U_FAILURE(status)) { + delete temp; + return nullptr; + } + } else { delete temp; + } } } if (!parser.dataVector.isEmpty()) { @@ -1126,6 +1134,13 @@ Transliterator::createFromRules(const UnicodeString& ID, return t; } transliterators.addElement(temprbt, status); + if (U_FAILURE(status)) { + delete temprbt; + return t; + } + // TODO: ICU-21701 the transliterators vector will leak its contents if anything goes wrong. + // Under normal operation, the CompoundTransliterator constructor adopts the + // the contents of the vector. } } |