ICU-23300 Fix static analyzer errors #3824
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix errors found by static analyzer (clangsa), when analyze chromium code. Part 5
icu4c/source/common/filteredbrk.cpp - partials can be nullptr after unsuccessful allocate memory
icu4c/source/common/loclikelysubtags.cpp - "Null pointer passed to 1st parameter expecting 'nonnull'"
icu4c/source/common/normalizer2impl.cpp - "Dereference of null pointer"
icu4c/source/common/ubidiln.cpp
icu4c/source/common/ubidiwrt.cpp - all doWriteXY can return only U_BUFFER_OVERFLOW_ERROR
icu4c/source/common/ucnv.cpp - "Address of stack memory associated with local variable 'replay' is still referred to by the caller variable 'args' upon returning to the caller. This will be a dangling reference"
icu4c/source/common/ucnv2022.cpp - "Out of bound access to memory after the end of 'jpCharsetMasks'" at changeState_2022
icu4c/source/common/unames.cpp - "Out of bound access to memory after the end of 'indexes'"
icu4c/source/common/unormcmp.cpp - "Out of bound access to memory preceding 'fold2'"
icu4c/source/common/ustrcase.cpp - "Out of bound access to memory preceding 'fold2'"
icu4c/source/i18n/calendar.cpp - "The right operand of '+' is a garbage value"
icu4c/source/i18n/collationweights.cpp - "Left shift by '32' overflows the capacity of 'unsigned int'"
icu4c/source/i18n/nfrs.cpp - "Division by zero"
icu4c/source/i18n/rbt_pars.cpp - "Out of bound access to memory preceding the field 'preContext'"
icu4c/source/i18n/stsearch.cpp - "Access to field 'matchedIndex' results in a dereference of a null pointer (loaded from field 'm_search_')"
icu4c/source/i18n/tridpars.cpp - "Access to field 'valueDeleter' results in a dereference of a null pointer (loaded from variable 'hash')"
icu4c/source/common/unisetspan.cpp - "Undefined or garbage value returned to caller"
Thank you for your pull request!
TODO: Fill out the checklist below.
Checklist