Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions icu4c/source/common/cmemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@ icu::MaybeStackArray<T, stackCapacity>::MaybeStackArray(
template<typename T, int32_t stackCapacity>
inline MaybeStackArray <T, stackCapacity>&
MaybeStackArray<T, stackCapacity>::operator=(MaybeStackArray <T, stackCapacity>&& src) noexcept {
if (this == &src) {
return *this;
}
releaseArray(); // in case this instance had its own memory allocated
capacity = src.capacity;
needToRelease = src.needToRelease;
Expand Down
4 changes: 4 additions & 0 deletions icu4c/source/common/normalizer2impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,10 @@ const char16_t *
Normalizer2Impl::decompose(const char16_t *src, const char16_t *limit,
ReorderingBuffer *buffer,
UErrorCode &errorCode) const {
if(src==nullptr) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return src;
}
UChar32 minNoCP=minDecompNoCP;
if(limit==nullptr) {
src=copyLowPrefixFromNulTerminated(src, minNoCP, buffer, errorCode);
Expand Down
4 changes: 2 additions & 2 deletions icu4c/source/common/uresbund.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1449,14 +1449,14 @@ UResourceBundle *init_resb_result(
}
if(key != nullptr) {
ures_appendResPath(resB, key, static_cast<int32_t>(uprv_strlen(key)), status);
if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
if(resB->fResPathLen > 0 && resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status);
}
} else if(idx >= 0) {
char buf[256];
int32_t len = T_CString_integerToString(buf, idx, 10);
ures_appendResPath(resB, buf, len, status);
if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
if(resB->fResPathLen > 0 && resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status);
}
}
Expand Down
3 changes: 3 additions & 0 deletions icu4c/source/i18n/calendar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,9 @@ void Calendar::roll(UCalendarDateFields field, int32_t amount, UErrorCode& statu
}
if (era > 0 || newYear >= 1) {
int32_t maxYear = getActualMaximum(field, status);
if (U_FAILURE(status)) {
return;
}
if (maxYear < 32768) {
// this era has real bounds, roll should wrap years
if (newYear < 1) {
Expand Down
3 changes: 3 additions & 0 deletions icu4c/source/i18n/dtptngen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2816,6 +2816,9 @@ PtnSkeleton::PtnSkeleton(const PtnSkeleton& other) {
}

void PtnSkeleton::copyFrom(const PtnSkeleton& other) {
if (this == &other) {
return;
}
uprv_memcpy(type, other.type, sizeof(type));
original.copyFrom(other.original);
baseOriginal.copyFrom(other.baseOriginal);
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/i18n/rulebasedcollator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ RuleBasedCollator::setReorderCodes(const int32_t *reorderCodes, int32_t length,
if(length == 1 && reorderCodes[0] == UCOL_REORDER_CODE_NONE) {
length = 0;
}
if(length == settings->reorderCodesLength &&
if(reorderCodes && length == settings->reorderCodesLength &&
uprv_memcmp(reorderCodes, settings->reorderCodes, length * 4) == 0) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions icu4c/source/i18n/uspoof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ uspoof_clone(const USpoofChecker *sc, UErrorCode *status) {
if (U_FAILURE(*status)) {
delete result;
result = nullptr;
return nullptr;
}
return result->asUSpoofChecker();
}
Expand Down