Compare commits
No commits in common. 'i10cs' and 'c9' have entirely different histories.
@ -1 +1 @@
|
|||||||
SOURCES/icu4c-74_2-src-FIXED.tgz
|
SOURCES/icu4c-67_1-src.tgz
|
||||||
|
@ -1 +1 @@
|
|||||||
43a8d688a3a6bc8f0f8c5e699d0ef7a905d24314 SOURCES/icu4c-74_2-src-FIXED.tgz
|
6822a4a94324d1ba591b3e8ef084e4491af253c1 SOURCES/icu4c-67_1-src.tgz
|
||||||
|
@ -1,390 +0,0 @@
|
|||||||
From af6fbac0bdba3080a8bcb5d12764d1fece2e9c1d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike FABIAN <mfabian@redhat.com>
|
|
||||||
Date: Mon, 23 Aug 2021 18:03:31 +0200
|
|
||||||
Subject: [PATCH 1/2] ICU-21667 Fix coverity warnings
|
|
||||||
|
|
||||||
See: https://unicode-org.atlassian.net/browse/ICU-21667
|
|
||||||
(Issues found by coverity in icu-69.1)
|
|
||||||
---
|
|
||||||
source/common/brkiter.cpp | 2 +
|
|
||||||
source/common/serv.cpp | 76 +++++++++++++----------
|
|
||||||
source/common/serv.h | 5 ++
|
|
||||||
source/common/uloc_keytype.cpp | 8 +++
|
|
||||||
source/common/umutablecptrie.cpp | 2 +-
|
|
||||||
source/common/uresbund.cpp | 3 +-
|
|
||||||
source/i18n/decNumber.h | 2 +-
|
|
||||||
source/i18n/rbt_pars.cpp | 7 +--
|
|
||||||
source/i18n/tridpars.cpp | 1 +
|
|
||||||
source/i18n/usearch.cpp | 2 +
|
|
||||||
source/i18n/uspoof_impl.cpp | 6 +-
|
|
||||||
source/tools/gensprep/store.c | 1 -
|
|
||||||
source/tools/makeconv/genmbcs.cpp | 4 ++
|
|
||||||
source/tools/pkgdata/pkgtypes.c | 12 ++--
|
|
||||||
source/tools/toolutil/filetools.cpp | 1 +
|
|
||||||
15 files changed, 84 insertions(+), 48 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/source/common/brkiter.cpp b/source/common/brkiter.cpp
|
|
||||||
index b452cf2c050..e2edbe8eaf6 100644
|
|
||||||
--- a/source/common/brkiter.cpp
|
|
||||||
+++ b/source/common/brkiter.cpp
|
|
||||||
@@ -107,7 +107,9 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /* coverity[incorrect_free] */
|
|
||||||
ures_close(brkRules);
|
|
||||||
+ /* coverity[incorrect_free] */
|
|
||||||
ures_close(brkName);
|
|
||||||
|
|
||||||
UDataMemory* file = udata_open(U_ICUDATA_BRKITR, ext, fnbuff, &status);
|
|
||||||
diff --git a/source/common/serv.cpp b/source/common/serv.cpp
|
|
||||||
index 5248f7c192b..ddf17e45069 100644
|
|
||||||
--- a/source/common/serv.cpp
|
|
||||||
+++ b/source/common/serv.cpp
|
|
||||||
@@ -722,49 +722,57 @@ UVector&
|
|
||||||
ICUService::getDisplayNames(UVector& result,
|
|
||||||
const Locale& locale,
|
|
||||||
const UnicodeString* matchID,
|
|
||||||
- UErrorCode& status) const
|
|
||||||
+ UErrorCode& status) const
|
|
||||||
{
|
|
||||||
+ // cast away semantic const
|
|
||||||
+ return const_cast<ICUService *>(this)->getDisplayNamesImpl(result, locale, matchID, status);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+UVector&
|
|
||||||
+ICUService::getDisplayNamesImpl(UVector& result,
|
|
||||||
+ const Locale& locale,
|
|
||||||
+ const UnicodeString* matchID,
|
|
||||||
+ UErrorCode& status)
|
|
||||||
+{
|
|
||||||
+ if (U_FAILURE(status)) { return result; }
|
|
||||||
result.removeAllElements();
|
|
||||||
result.setDeleter(userv_deleteStringPair);
|
|
||||||
- if (U_SUCCESS(status)) {
|
|
||||||
- ICUService* ncthis = (ICUService*)this; // cast away semantic const
|
|
||||||
- Mutex mutex(&lock);
|
|
||||||
+ Mutex mutex(&lock);
|
|
||||||
|
|
||||||
- if (dnCache != nullptr && dnCache->locale != locale) {
|
|
||||||
- delete dnCache;
|
|
||||||
- ncthis->dnCache = nullptr;
|
|
||||||
- }
|
|
||||||
+ if (dnCache != nullptr && dnCache->locale != locale) {
|
|
||||||
+ delete dnCache;
|
|
||||||
+ dnCache = nullptr;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
+ if (dnCache == nullptr) {
|
|
||||||
+ const Hashtable* m = getVisibleIDMap(status);
|
|
||||||
+ if (U_FAILURE(status)) {
|
|
||||||
+ return result;
|
|
||||||
+ }
|
|
||||||
+ dnCache = new DNCache(locale);
|
|
||||||
if (dnCache == nullptr) {
|
|
||||||
- const Hashtable* m = getVisibleIDMap(status);
|
|
||||||
- if (U_FAILURE(status)) {
|
|
||||||
- return result;
|
|
||||||
- }
|
|
||||||
- ncthis->dnCache = new DNCache(locale);
|
|
||||||
- if (dnCache == nullptr) {
|
|
||||||
- status = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
- return result;
|
|
||||||
- }
|
|
||||||
+ status = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
+ return result;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- int32_t pos = UHASH_FIRST;
|
|
||||||
- const UHashElement* entry = nullptr;
|
|
||||||
- while ((entry = m->nextElement(pos)) != nullptr) {
|
|
||||||
- const UnicodeString* id = (const UnicodeString*)entry->key.pointer;
|
|
||||||
- ICUServiceFactory* f = (ICUServiceFactory*)entry->value.pointer;
|
|
||||||
- UnicodeString dname;
|
|
||||||
- f->getDisplayName(*id, locale, dname);
|
|
||||||
- if (dname.isBogus()) {
|
|
||||||
- status = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
- } else {
|
|
||||||
- dnCache->cache.put(dname, (void*)id, status); // share pointer with visibleIDMap
|
|
||||||
- if (U_SUCCESS(status)) {
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
+ int32_t pos = UHASH_FIRST;
|
|
||||||
+ const UHashElement* entry = nullptr;
|
|
||||||
+ while ((entry = m->nextElement(pos)) != nullptr) {
|
|
||||||
+ const UnicodeString* id = static_cast<const UnicodeString*>(entry->key.pointer);
|
|
||||||
+ ICUServiceFactory* f = static_cast<ICUServiceFactory*>(entry->value.pointer);
|
|
||||||
+ UnicodeString dname;
|
|
||||||
+ f->getDisplayName(*id, locale, dname);
|
|
||||||
+ if (dname.isBogus()) {
|
|
||||||
+ status = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
+ } else {
|
|
||||||
+ dnCache->cache.put(dname, (void*)id, status); // share pointer with visibleIDMap
|
|
||||||
+ if (U_SUCCESS(status)) {
|
|
||||||
+ continue;
|
|
||||||
}
|
|
||||||
- delete dnCache;
|
|
||||||
- ncthis->dnCache = nullptr;
|
|
||||||
- return result;
|
|
||||||
}
|
|
||||||
+ delete dnCache;
|
|
||||||
+ dnCache = nullptr;
|
|
||||||
+ return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/source/common/serv.h b/source/common/serv.h
|
|
||||||
index 9aea548fc3a..3c53f228738 100644
|
|
||||||
--- a/source/common/serv.h
|
|
||||||
+++ b/source/common/serv.h
|
|
||||||
@@ -759,6 +759,11 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|
||||||
const UnicodeString* matchID,
|
|
||||||
UErrorCode& status) const;
|
|
||||||
|
|
||||||
+ UVector& getDisplayNamesImpl(UVector& result,
|
|
||||||
+ const Locale& locale,
|
|
||||||
+ const UnicodeString* matchID,
|
|
||||||
+ UErrorCode& status);
|
|
||||||
+
|
|
||||||
/**
|
|
||||||
* <p>A convenience override of registerInstance(UObject*, const UnicodeString&, UBool)
|
|
||||||
* that defaults visible to true.</p>
|
|
||||||
diff --git a/source/common/uloc_keytype.cpp b/source/common/uloc_keytype.cpp
|
|
||||||
index a84b8609079..a837e0f14a7 100644
|
|
||||||
--- a/source/common/uloc_keytype.cpp
|
|
||||||
+++ b/source/common/uloc_keytype.cpp
|
|
||||||
@@ -327,12 +327,20 @@ initFromResourceBundle(UErrorCode& sts) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (U_FAILURE(sts)) {
|
|
||||||
+ if (typeDataMap != NULL) {
|
|
||||||
+ uhash_close(typeDataMap);
|
|
||||||
+ typeDataMap = NULL;
|
|
||||||
+ }
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
LocExtKeyData* keyData = gLocExtKeyDataEntries->create();
|
|
||||||
if (keyData == nullptr) {
|
|
||||||
sts = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
+ if (typeDataMap != NULL) {
|
|
||||||
+ uhash_close(typeDataMap);
|
|
||||||
+ typeDataMap = NULL;
|
|
||||||
+ }
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
keyData->bcpId = bcpKeyId;
|
|
||||||
diff --git a/source/common/umutablecptrie.cpp b/source/common/umutablecptrie.cpp
|
|
||||||
index cdbe27080b4..e58ab6f4897 100644
|
|
||||||
--- a/source/common/umutablecptrie.cpp
|
|
||||||
+++ b/source/common/umutablecptrie.cpp
|
|
||||||
@@ -1543,7 +1543,7 @@ int32_t MutableCodePointTrie::compactTrie(int32_t fastILimit, UErrorCode &errorC
|
|
||||||
MixedBlocks mixedBlocks;
|
|
||||||
int32_t newDataLength = compactData(fastILimit, newData, newDataCapacity,
|
|
||||||
dataNullIndex, mixedBlocks, errorCode);
|
|
||||||
- if (U_FAILURE(errorCode)) { return 0; }
|
|
||||||
+ if (U_FAILURE(errorCode)) { uprv_free(newData); return 0; }
|
|
||||||
U_ASSERT(newDataLength <= newDataCapacity);
|
|
||||||
uprv_free(data);
|
|
||||||
data = newData;
|
|
||||||
diff --git a/source/common/uresbund.cpp b/source/common/uresbund.cpp
|
|
||||||
index 5aa1c5fa2f1..7d16cd048ef 100644
|
|
||||||
--- a/source/common/uresbund.cpp
|
|
||||||
+++ b/source/common/uresbund.cpp
|
|
||||||
@@ -2927,7 +2927,8 @@ typedef struct ULocalesContext {
|
|
||||||
|
|
||||||
static void U_CALLCONV
|
|
||||||
ures_loc_closeLocales(UEnumeration *enumerator) {
|
|
||||||
- ULocalesContext *ctx = (ULocalesContext *)enumerator->context;
|
|
||||||
+ if (enumerator == nullptr) { return; }
|
|
||||||
+ ULocalesContext* ctx = (ULocalesContext *)(enumerator->context);
|
|
||||||
ures_close(&ctx->curr);
|
|
||||||
ures_close(&ctx->installed);
|
|
||||||
uprv_free(ctx);
|
|
||||||
diff --git a/source/i18n/decNumber.h b/source/i18n/decNumber.h
|
|
||||||
index 4a1eb364e19..6ad94386c1f 100644
|
|
||||||
--- a/source/i18n/decNumber.h
|
|
||||||
+++ b/source/i18n/decNumber.h
|
|
||||||
@@ -86,7 +86,7 @@
|
|
||||||
/* range: -1999999997 through 999999999 */
|
|
||||||
uint8_t bits; /* Indicator bits (see above) */
|
|
||||||
/* Coefficient, from least significant unit */
|
|
||||||
- decNumberUnit lsu[DECNUMUNITS];
|
|
||||||
+ decNumberUnit lsu[DECNUMUNITS+2];
|
|
||||||
} decNumber;
|
|
||||||
|
|
||||||
/* Notes: */
|
|
||||||
diff --git a/source/i18n/rbt_pars.cpp b/source/i18n/rbt_pars.cpp
|
|
||||||
index 10482d5edb1..c59a22faab2 100644
|
|
||||||
--- a/source/i18n/rbt_pars.cpp
|
|
||||||
+++ b/source/i18n/rbt_pars.cpp
|
|
||||||
@@ -552,16 +552,15 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
|
|
||||||
case ALT_FUNCTION:
|
|
||||||
{
|
|
||||||
int32_t iref = pos;
|
|
||||||
- TransliteratorIDParser::SingleID* single =
|
|
||||||
- TransliteratorIDParser::parseFilterID(rule, iref);
|
|
||||||
+ LocalPointer<TransliteratorIDParser::SingleID> single(
|
|
||||||
+ TransliteratorIDParser::parseFilterID(rule, iref));
|
|
||||||
// The next character MUST be a segment open
|
|
||||||
- if (single == nullptr ||
|
|
||||||
+ if (single.isNull() ||
|
|
||||||
!ICU_Utility::parseChar(rule, iref, SEGMENT_OPEN)) {
|
|
||||||
return syntaxError(U_INVALID_FUNCTION, rule, start, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
Transliterator *t = single->createInstance();
|
|
||||||
- delete single;
|
|
||||||
if (t == nullptr) {
|
|
||||||
return syntaxError(U_INVALID_FUNCTION, rule, start, status);
|
|
||||||
}
|
|
||||||
diff --git a/source/i18n/tridpars.cpp b/source/i18n/tridpars.cpp
|
|
||||||
index 6c23a0dc902..f9c3c207025 100644
|
|
||||||
--- a/source/i18n/tridpars.cpp
|
|
||||||
+++ b/source/i18n/tridpars.cpp
|
|
||||||
@@ -136,6 +136,7 @@ TransliteratorIDParser::parseSingleID(const UnicodeString& id, int32_t& pos,
|
|
||||||
specsB = parseFilterID(id, pos, true);
|
|
||||||
// Must close with a ')'
|
|
||||||
if (specsB == nullptr || !ICU_Utility::parseChar(id, pos, CLOSE_REV)) {
|
|
||||||
+ delete specsB;
|
|
||||||
delete specsA;
|
|
||||||
pos = start;
|
|
||||||
return nullptr;
|
|
||||||
diff --git a/source/i18n/usearch.cpp b/source/i18n/usearch.cpp
|
|
||||||
index 6d9b60cef72..1fb82fe26a4 100644
|
|
||||||
--- a/source/i18n/usearch.cpp
|
|
||||||
+++ b/source/i18n/usearch.cpp
|
|
||||||
@@ -199,6 +199,7 @@ inline int32_t * addTouint32_tArray(int32_t *destination,
|
|
||||||
int32_t *temp = (int32_t *)allocateMemory(
|
|
||||||
sizeof(int32_t) * newlength, status);
|
|
||||||
if (U_FAILURE(*status)) {
|
|
||||||
+ uprv_free(temp);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
uprv_memcpy(temp, destination, sizeof(int32_t) * (size_t)offset);
|
|
||||||
@@ -240,6 +241,7 @@ inline int64_t * addTouint64_tArray(int64_t *destination,
|
|
||||||
sizeof(int64_t) * newlength, status);
|
|
||||||
|
|
||||||
if (U_FAILURE(*status)) {
|
|
||||||
+ uprv_free(temp);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/source/i18n/uspoof_impl.cpp b/source/i18n/uspoof_impl.cpp
|
|
||||||
index 7a6084a1096..a1bd7d66a92 100644
|
|
||||||
--- a/source/i18n/uspoof_impl.cpp
|
|
||||||
+++ b/source/i18n/uspoof_impl.cpp
|
|
||||||
@@ -194,8 +194,12 @@ void SpoofImpl::setAllowedLocales(const char *localesList, UErrorCode &status) {
|
|
||||||
|
|
||||||
// Store the updated spoof checker state.
|
|
||||||
tmpSet = allowedChars.clone();
|
|
||||||
+ if (tmpSet == nullptr) {
|
|
||||||
+ status = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
const char *tmpLocalesList = uprv_strdup(localesList);
|
|
||||||
- if (tmpSet == nullptr || tmpLocalesList == nullptr) {
|
|
||||||
+ if (tmpLocalesList == nullptr) {
|
|
||||||
status = U_MEMORY_ALLOCATION_ERROR;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
diff --git a/source/tools/gensprep/store.c b/source/tools/gensprep/store.c
|
|
||||||
index c3712febb4c..377877c94be 100644
|
|
||||||
--- a/source/tools/gensprep/store.c
|
|
||||||
+++ b/source/tools/gensprep/store.c
|
|
||||||
@@ -638,7 +638,6 @@ extern void
|
|
||||||
cleanUpData(void) {
|
|
||||||
uprv_free(mappingData);
|
|
||||||
utrie_close(sprepTrie);
|
|
||||||
- uprv_free(sprepTrie);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* #if !UCONFIG_NO_IDNA */
|
|
||||||
diff --git a/source/tools/makeconv/genmbcs.cpp b/source/tools/makeconv/genmbcs.cpp
|
|
||||||
index 43b96d814fb..0f610afeee4 100644
|
|
||||||
--- a/source/tools/makeconv/genmbcs.cpp
|
|
||||||
+++ b/source/tools/makeconv/genmbcs.cpp
|
|
||||||
@@ -173,6 +173,10 @@ MBCSOpen(UCMFile *ucm) {
|
|
||||||
}
|
|
||||||
|
|
||||||
MBCSInit(mbcsData, ucm);
|
|
||||||
+ /* The memory in the MBSData structure following
|
|
||||||
+ * newConverter will be properly freed in MBCSClose.
|
|
||||||
+ */
|
|
||||||
+ /* coverity[leaked_storage] */
|
|
||||||
return &mbcsData->newConverter;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/source/tools/pkgdata/pkgtypes.c b/source/tools/pkgdata/pkgtypes.c
|
|
||||||
index 26bd945df73..ba516861a01 100644
|
|
||||||
--- a/source/tools/pkgdata/pkgtypes.c
|
|
||||||
+++ b/source/tools/pkgdata/pkgtypes.c
|
|
||||||
@@ -31,6 +31,7 @@ const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim,
|
|
||||||
{
|
|
||||||
int32_t ln = 0;
|
|
||||||
char buffer[1024];
|
|
||||||
+ char *bufferp = buffer;
|
|
||||||
while(l != NULL)
|
|
||||||
{
|
|
||||||
if(l->str)
|
|
||||||
@@ -43,7 +44,7 @@ const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim,
|
|
||||||
buffer[uprv_strlen(buffer)-1] = '\0';
|
|
||||||
}
|
|
||||||
if(buffer[0] == '"') {
|
|
||||||
- uprv_strcpy(buffer, buffer+1);
|
|
||||||
+ bufferp = buffer+1;
|
|
||||||
}
|
|
||||||
} else if(quote > 0) { /* add quotes */
|
|
||||||
if(l->str[0] != '"') {
|
|
||||||
@@ -54,7 +55,7 @@ const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim,
|
|
||||||
uprv_strcat(buffer, "\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- T_FileStream_write(s, buffer, (int32_t)uprv_strlen(buffer));
|
|
||||||
+ T_FileStream_write(s, bufferp, (int32_t)uprv_strlen(bufferp));
|
|
||||||
|
|
||||||
ln += (int32_t)uprv_strlen(l->str);
|
|
||||||
}
|
|
||||||
@@ -75,7 +76,8 @@ const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim,
|
|
||||||
|
|
||||||
const char *pkg_writeCharList(FileStream *s, CharList *l, const char *delim, int32_t quote)
|
|
||||||
{
|
|
||||||
- char buffer[1024];
|
|
||||||
+ char buffer[1026]; /* 1026 instead of 1024 because quotes may be added */
|
|
||||||
+ char *bufferp = buffer;
|
|
||||||
while(l != NULL)
|
|
||||||
{
|
|
||||||
if(l->str)
|
|
||||||
@@ -93,7 +95,7 @@ const char *pkg_writeCharList(FileStream *s, CharList *l, const char *delim, int
|
|
||||||
buffer[uprv_strlen(buffer)-1] = '\0';
|
|
||||||
}
|
|
||||||
if(buffer[0] == '"') {
|
|
||||||
- uprv_strcpy(buffer, buffer+1);
|
|
||||||
+ bufferp = buffer+1;
|
|
||||||
}
|
|
||||||
} else if(quote > 0) { /* add quotes */
|
|
||||||
if(l->str[0] != '"') {
|
|
||||||
@@ -104,7 +106,7 @@ const char *pkg_writeCharList(FileStream *s, CharList *l, const char *delim, int
|
|
||||||
uprv_strcat(buffer, "\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- T_FileStream_write(s, buffer, (int32_t)uprv_strlen(buffer));
|
|
||||||
+ T_FileStream_write(s, bufferp, (int32_t)uprv_strlen(bufferp));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(l->next && delim)
|
|
||||||
diff --git a/source/tools/toolutil/filetools.cpp b/source/tools/toolutil/filetools.cpp
|
|
||||||
index 994d8e31f00..8dcbb6a480a 100644
|
|
||||||
--- a/source/tools/toolutil/filetools.cpp
|
|
||||||
+++ b/source/tools/toolutil/filetools.cpp
|
|
||||||
@@ -64,6 +64,7 @@ isFileModTimeLater(const char *filePath, const char *checkAgainst, UBool isDir)
|
|
||||||
newpath.append(dirEntry->d_name, -1, status);
|
|
||||||
if (U_FAILURE(status)) {
|
|
||||||
fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, u_errorName(status));
|
|
||||||
+ closedir(pDir);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.46.1
|
|
||||||
|
|
@ -1,487 +0,0 @@
|
|||||||
From ac0192d1de167e11f2d8a28e2781941be4f60877 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike FABIAN <mfabian@redhat.com>
|
|
||||||
Date: Mon, 19 Aug 2024 16:15:01 +0200
|
|
||||||
Subject: [PATCH 2/2] Fix coverity warnings icu-74.2
|
|
||||||
|
|
||||||
---
|
|
||||||
source/common/loclikelysubtags.cpp | 1 +
|
|
||||||
source/common/ubidi.cpp | 1 +
|
|
||||||
source/common/ubiditransform.cpp | 2 +-
|
|
||||||
source/common/ucnv.cpp | 3 ++-
|
|
||||||
source/common/ucnv2022.cpp | 2 ++
|
|
||||||
source/common/ucnv_u16.cpp | 2 ++
|
|
||||||
source/common/ucnv_u7.cpp | 1 +
|
|
||||||
source/common/ucnvmbcs.cpp | 1 +
|
|
||||||
source/common/ucnvscsu.cpp | 2 ++
|
|
||||||
source/common/umutablecptrie.cpp | 1 +
|
|
||||||
source/common/unames.cpp | 1 +
|
|
||||||
source/i18n/collationrootelements.cpp | 2 ++
|
|
||||||
source/i18n/dayperiodrules.cpp | 1 +
|
|
||||||
source/i18n/double-conversion-bignum.cpp | 3 +++
|
|
||||||
source/i18n/measfmt.cpp | 1 +
|
|
||||||
source/i18n/measunit.cpp | 3 +++
|
|
||||||
source/i18n/number_fluent.cpp | 1 +
|
|
||||||
source/i18n/number_padding.cpp | 1 +
|
|
||||||
source/i18n/number_rounding.cpp | 2 ++
|
|
||||||
source/i18n/number_skeletons.cpp | 1 +
|
|
||||||
source/i18n/numrange_fluent.cpp | 1 +
|
|
||||||
source/i18n/plurrule.cpp | 1 +
|
|
||||||
source/i18n/rbt_pars.cpp | 1 +
|
|
||||||
source/i18n/tzgnames.cpp | 1 +
|
|
||||||
source/i18n/vtzone.cpp | 2 +-
|
|
||||||
source/tools/gencnval/gencnval.c | 5 +++++
|
|
||||||
source/tools/genrb/wrtxml.cpp | 2 +-
|
|
||||||
source/tools/makeconv/makeconv.cpp | 4 ++++
|
|
||||||
source/tools/toolutil/package.cpp | 1 +
|
|
||||||
source/tools/toolutil/ucbuf.cpp | 2 +-
|
|
||||||
30 files changed, 47 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/source/common/loclikelysubtags.cpp b/source/common/loclikelysubtags.cpp
|
|
||||||
index c2a7011b509..7943b6d2489 100644
|
|
||||||
--- a/source/common/loclikelysubtags.cpp
|
|
||||||
+++ b/source/common/loclikelysubtags.cpp
|
|
||||||
@@ -736,6 +736,7 @@ int32_t XLikelySubtags::getLikelyIndex(const char *language, const char *script)
|
|
||||||
int32_t value;
|
|
||||||
// Small optimization: Array lookup for first language letter.
|
|
||||||
int32_t c0;
|
|
||||||
+ /* coverity[overrun-local] */
|
|
||||||
if (0 <= (c0 = uprv_lowerOrdinal(language[0])) && c0 <= 25 &&
|
|
||||||
language[1] != 0 && // language.length() >= 2
|
|
||||||
(state = trieFirstLetterStates[c0]) != 0) {
|
|
||||||
diff --git a/source/common/ubidi.cpp b/source/common/ubidi.cpp
|
|
||||||
index fcf82fa97a8..18a179a15f7 100644
|
|
||||||
--- a/source/common/ubidi.cpp
|
|
||||||
+++ b/source/common/ubidi.cpp
|
|
||||||
@@ -1276,6 +1276,7 @@ resolveExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
|
|
||||||
} else
|
|
||||||
/* make it WS so that it is handled by adjustWSLevels() */
|
|
||||||
dirProps[i]=WS;
|
|
||||||
+ /* coverity[overrun-local] */
|
|
||||||
embeddingLevel=(UBiDiLevel)stack[stackLast]&~ISOLATE;
|
|
||||||
flags|=(DIRPROP_FLAG(ON)|DIRPROP_FLAG_LR(embeddingLevel));
|
|
||||||
previousLevel=embeddingLevel;
|
|
||||||
diff --git a/source/common/ubiditransform.cpp b/source/common/ubiditransform.cpp
|
|
||||||
index 01f5901a2c2..23634742b88 100644
|
|
||||||
--- a/source/common/ubiditransform.cpp
|
|
||||||
+++ b/source/common/ubiditransform.cpp
|
|
||||||
@@ -499,7 +499,7 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform,
|
|
||||||
/* Checking for U_SUCCESS() within the loop to bail out on first failure. */
|
|
||||||
for (action = pBiDiTransform->pActiveScheme->actions; *action && U_SUCCESS(*pErrorCode); action++) {
|
|
||||||
if ((*action)(pBiDiTransform, pErrorCode)) {
|
|
||||||
- if (action + 1) {
|
|
||||||
+ if (action[1] != nullptr) {
|
|
||||||
updateSrc(pBiDiTransform, pBiDiTransform->dest, *pBiDiTransform->pDestLength,
|
|
||||||
*pBiDiTransform->pDestLength, pErrorCode);
|
|
||||||
}
|
|
||||||
diff --git a/source/common/ucnv.cpp b/source/common/ucnv.cpp
|
|
||||||
index a7a07d65d61..87b4cd8ace5 100644
|
|
||||||
--- a/source/common/ucnv.cpp
|
|
||||||
+++ b/source/common/ucnv.cpp
|
|
||||||
@@ -105,7 +105,7 @@ ucnv_openU (const char16_t * name,
|
|
||||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
- return ucnv_open(u_austrcpy(asciiName, name), err);
|
|
||||||
+ return ucnv_open(u_austrncpy(asciiName, name, UCNV_MAX_CONVERTER_NAME_LENGTH), err);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy the string that is represented by the UConverterPlatform enum
|
|
||||||
@@ -2240,6 +2240,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The pivot buffer is empty; reset it so we start at pivotStart. */
|
|
||||||
+ /* coverity[escape_local_addr_alias] */
|
|
||||||
*pivotSource=*pivotTarget=pivotStart;
|
|
||||||
|
|
||||||
/*
|
|
||||||
diff --git a/source/common/ucnv2022.cpp b/source/common/ucnv2022.cpp
|
|
||||||
index 5989c1b405a..7d5b450d78a 100644
|
|
||||||
--- a/source/common/ucnv2022.cpp
|
|
||||||
+++ b/source/common/ucnv2022.cpp
|
|
||||||
@@ -3108,6 +3108,7 @@ UConverter_fromUnicode_ISO_2022_CN_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args
|
|
||||||
} else {
|
|
||||||
/* GB2312_1 or ISO-IR-165 */
|
|
||||||
U_ASSERT(cs0<UCNV_2022_MAX_CONVERTERS);
|
|
||||||
+ /* coverity[overrun-local] */
|
|
||||||
len2 = MBCS_FROM_UCHAR32_ISO2022(
|
|
||||||
converterData->myConverterArray[cs0],
|
|
||||||
sourceChar,
|
|
||||||
@@ -3392,6 +3393,7 @@ UConverter_toUnicode_ISO_2022_CN_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
|
|
||||||
|
|
||||||
}else{
|
|
||||||
U_ASSERT(tempState<UCNV_2022_MAX_CONVERTERS);
|
|
||||||
+ /* coverity[overrun-local] */
|
|
||||||
cnv = myData->myConverterArray[tempState];
|
|
||||||
tempBuf[0] = (char) (mySourceChar);
|
|
||||||
tempBuf[1] = (char) trailByte;
|
|
||||||
diff --git a/source/common/ucnv_u16.cpp b/source/common/ucnv_u16.cpp
|
|
||||||
index c3bcfef50cb..70dfbe89884 100644
|
|
||||||
--- a/source/common/ucnv_u16.cpp
|
|
||||||
+++ b/source/common/ucnv_u16.cpp
|
|
||||||
@@ -234,6 +234,7 @@ _UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|
||||||
|
|
||||||
if(length>0) {
|
|
||||||
/* output length bytes with overflow (length>targetCapacity>0) */
|
|
||||||
+ /* coverity[uninit_use_in_call] */
|
|
||||||
ucnv_fromUWriteBytes(cnv,
|
|
||||||
overflow, length,
|
|
||||||
(char **)&target, pArgs->targetLimit,
|
|
||||||
@@ -835,6 +836,7 @@ _UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|
||||||
|
|
||||||
if(length>0) {
|
|
||||||
/* output length bytes with overflow (length>targetCapacity>0) */
|
|
||||||
+ /* coverity[uninit_use_in_call] */
|
|
||||||
ucnv_fromUWriteBytes(cnv,
|
|
||||||
overflow, length,
|
|
||||||
&target, pArgs->targetLimit,
|
|
||||||
diff --git a/source/common/ucnv_u7.cpp b/source/common/ucnv_u7.cpp
|
|
||||||
index 398b528e832..6df77253b12 100644
|
|
||||||
--- a/source/common/ucnv_u7.cpp
|
|
||||||
+++ b/source/common/ucnv_u7.cpp
|
|
||||||
@@ -617,6 +617,7 @@ _UTF7FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|
||||||
base64Counter=1;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
+ /* coverity[deref_overflow] */
|
|
||||||
*target++=toBase64[bits|(c>>14)];
|
|
||||||
if(target<targetLimit) {
|
|
||||||
*target++=toBase64[(c>>8)&0x3f];
|
|
||||||
diff --git a/source/common/ucnvmbcs.cpp b/source/common/ucnvmbcs.cpp
|
|
||||||
index d7606039800..9277ad25837 100644
|
|
||||||
--- a/source/common/ucnvmbcs.cpp
|
|
||||||
+++ b/source/common/ucnvmbcs.cpp
|
|
||||||
@@ -2839,6 +2839,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|
||||||
/* Back out bytes from the previous buffer: Need to replay them. */
|
|
||||||
cnv->preToULength=(int8_t)(bytesFromThisBuffer-backOutDistance);
|
|
||||||
/* preToULength is negative! */
|
|
||||||
+ /* coverity[overflow_sink] */
|
|
||||||
uprv_memcpy(cnv->preToU, bytes+i, -cnv->preToULength);
|
|
||||||
source=(const uint8_t *)pArgs->source;
|
|
||||||
}
|
|
||||||
diff --git a/source/common/ucnvscsu.cpp b/source/common/ucnvscsu.cpp
|
|
||||||
index 2138e289cad..30a1b69824b 100644
|
|
||||||
--- a/source/common/ucnvscsu.cpp
|
|
||||||
+++ b/source/common/ucnvscsu.cpp
|
|
||||||
@@ -402,6 +402,7 @@ _SCSUToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|
||||||
case quoteOne:
|
|
||||||
if(b<0x80) {
|
|
||||||
/* all static offsets are in the BMP */
|
|
||||||
+ /* coverity[deref_overflow] */
|
|
||||||
*target++=(char16_t)(staticOffsets[quoteWindow]+b);
|
|
||||||
if(offsets!=nullptr) {
|
|
||||||
*offsets++=sourceIndex;
|
|
||||||
@@ -642,6 +643,7 @@ _SCSUToUnicode(UConverterToUnicodeArgs *pArgs,
|
|
||||||
*target++=(char16_t)b;
|
|
||||||
} else {
|
|
||||||
/* write from dynamic window */
|
|
||||||
+ /* coverity[deref_overflow] */
|
|
||||||
uint32_t c=scsu->toUDynamicOffsets[dynamicWindow]+(b&0x7f);
|
|
||||||
if(c<=0xffff) {
|
|
||||||
*target++=(char16_t)c;
|
|
||||||
diff --git a/source/common/umutablecptrie.cpp b/source/common/umutablecptrie.cpp
|
|
||||||
index e58ab6f4897..502dfad5a50 100644
|
|
||||||
--- a/source/common/umutablecptrie.cpp
|
|
||||||
+++ b/source/common/umutablecptrie.cpp
|
|
||||||
@@ -534,6 +534,7 @@ void MutableCodePointTrie::setRange(UChar32 start, UChar32 end, uint32_t value,
|
|
||||||
// Iterate over all-value blocks.
|
|
||||||
while (start < limit) {
|
|
||||||
int32_t i = start >> UCPTRIE_SHIFT_3;
|
|
||||||
+ /* coverity[overrun-local] */
|
|
||||||
if (flags[i] == ALL_SAME) {
|
|
||||||
index[i] = value;
|
|
||||||
} else /* MIXED */ {
|
|
||||||
diff --git a/source/common/unames.cpp b/source/common/unames.cpp
|
|
||||||
index 1b3192bf25e..c01c9d2db04 100644
|
|
||||||
--- a/source/common/unames.cpp
|
|
||||||
+++ b/source/common/unames.cpp
|
|
||||||
@@ -1561,6 +1561,7 @@ u_charFromName(UCharNameChoice nameChoice,
|
|
||||||
|
|
||||||
/* try extended names first */
|
|
||||||
if (lower[0] == '<') {
|
|
||||||
+ /* coverity[deref_overflow] */
|
|
||||||
if (nameChoice == U_EXTENDED_CHAR_NAME && lower[--i] == '>') {
|
|
||||||
// Parse a string like "<category-HHHH>" where HHHH is a hex code point.
|
|
||||||
uint32_t limit = i;
|
|
||||||
diff --git a/source/i18n/collationrootelements.cpp b/source/i18n/collationrootelements.cpp
|
|
||||||
index 9b46d14144b..54fa479617a 100644
|
|
||||||
--- a/source/i18n/collationrootelements.cpp
|
|
||||||
+++ b/source/i18n/collationrootelements.cpp
|
|
||||||
@@ -127,6 +127,7 @@ CollationRootElements::getSecondaryBefore(uint32_t p, uint32_t s) const {
|
|
||||||
} else {
|
|
||||||
index = findPrimary(p) + 1;
|
|
||||||
previousSec = Collation::BEFORE_WEIGHT16;
|
|
||||||
+ /* coverity[overflow_sink] */
|
|
||||||
sec = getFirstSecTerForPrimary(index) >> 16;
|
|
||||||
}
|
|
||||||
U_ASSERT(s >= sec);
|
|
||||||
@@ -157,6 +158,7 @@ CollationRootElements::getTertiaryBefore(uint32_t p, uint32_t s, uint32_t t) con
|
|
||||||
} else {
|
|
||||||
index = findPrimary(p) + 1;
|
|
||||||
previousTer = Collation::BEFORE_WEIGHT16;
|
|
||||||
+ /* coverity[overflow_sink] */
|
|
||||||
secTer = getFirstSecTerForPrimary(index);
|
|
||||||
}
|
|
||||||
uint32_t st = (s << 16) | t;
|
|
||||||
diff --git a/source/i18n/dayperiodrules.cpp b/source/i18n/dayperiodrules.cpp
|
|
||||||
index 294390cce2b..95befe8301c 100644
|
|
||||||
--- a/source/i18n/dayperiodrules.cpp
|
|
||||||
+++ b/source/i18n/dayperiodrules.cpp
|
|
||||||
@@ -218,6 +218,7 @@ struct DayPeriodRulesDataSink : public ResourceSink {
|
|
||||||
}
|
|
||||||
if (hour == 25) { hour = 0; }
|
|
||||||
if (cutoffs[hour] & (1 << CUTOFF_TYPE_BEFORE)) {
|
|
||||||
+ /* coverity[overrun-call] */
|
|
||||||
rule.add(startHour, hour, period);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
diff --git a/source/i18n/double-conversion-bignum.cpp b/source/i18n/double-conversion-bignum.cpp
|
|
||||||
index d2b701a21d8..77bab875aab 100644
|
|
||||||
--- a/source/i18n/double-conversion-bignum.cpp
|
|
||||||
+++ b/source/i18n/double-conversion-bignum.cpp
|
|
||||||
@@ -390,6 +390,7 @@ void Bignum::Square() {
|
|
||||||
// First shift the digits so we don't overwrite them.
|
|
||||||
const int copy_offset = used_bigits_;
|
|
||||||
for (int i = 0; i < used_bigits_; ++i) {
|
|
||||||
+ /* coverity[overrun-call] */
|
|
||||||
RawBigit(copy_offset + i) = RawBigit(i);
|
|
||||||
}
|
|
||||||
// We have two loops to avoid some 'if's in the loop.
|
|
||||||
@@ -415,7 +416,9 @@ void Bignum::Square() {
|
|
||||||
// Invariant: sum of both indices is again equal to i.
|
|
||||||
// Inner loop runs 0 times on last iteration, emptying accumulator.
|
|
||||||
while (bigit_index2 < used_bigits_) {
|
|
||||||
+ /* coverity[overrun-call] */
|
|
||||||
const Chunk chunk1 = RawBigit(copy_offset + bigit_index1);
|
|
||||||
+ /* coverity[overrun-call] */
|
|
||||||
const Chunk chunk2 = RawBigit(copy_offset + bigit_index2);
|
|
||||||
accumulator += static_cast<DoubleChunk>(chunk1) * chunk2;
|
|
||||||
bigit_index1--;
|
|
||||||
diff --git a/source/i18n/measfmt.cpp b/source/i18n/measfmt.cpp
|
|
||||||
index da4e69b49b7..09be56fcf33 100644
|
|
||||||
--- a/source/i18n/measfmt.cpp
|
|
||||||
+++ b/source/i18n/measfmt.cpp
|
|
||||||
@@ -516,6 +516,7 @@ UnicodeString &MeasureFormat::formatMeasurePerUnit(
|
|
||||||
.formatImpl(&result, status);
|
|
||||||
}
|
|
||||||
DecimalFormat::fieldPositionHelper(result, pos, appendTo.length(), status);
|
|
||||||
+ /* coverity[uninit_use_in_call] */
|
|
||||||
appendTo.append(result.toTempString(status));
|
|
||||||
return appendTo;
|
|
||||||
}
|
|
||||||
diff --git a/source/i18n/measunit.cpp b/source/i18n/measunit.cpp
|
|
||||||
index abb21997705..bff3e6273af 100644
|
|
||||||
--- a/source/i18n/measunit.cpp
|
|
||||||
+++ b/source/i18n/measunit.cpp
|
|
||||||
@@ -2230,6 +2230,7 @@ const char *MeasureUnit::getSubtype() const {
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *MeasureUnit::getIdentifier() const {
|
|
||||||
+ /* coverity[negative_returns] */
|
|
||||||
return fImpl ? fImpl->identifier.data() : gSubTypes[getOffset()];
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -2340,6 +2341,7 @@ void MeasureUnit::initTime(const char *timeId) {
|
|
||||||
int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "duration");
|
|
||||||
U_ASSERT(result != -1);
|
|
||||||
fTypeId = result;
|
|
||||||
+ /* coverity[negative_returns] */
|
|
||||||
result = binarySearch(gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], timeId);
|
|
||||||
U_ASSERT(result != -1);
|
|
||||||
fSubTypeId = result - gOffsets[fTypeId];
|
|
||||||
@@ -2349,6 +2351,7 @@ void MeasureUnit::initCurrency(StringPiece isoCurrency) {
|
|
||||||
int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "currency");
|
|
||||||
U_ASSERT(result != -1);
|
|
||||||
fTypeId = result;
|
|
||||||
+ /* coverity[negative_returns] */
|
|
||||||
result = binarySearch(
|
|
||||||
gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], isoCurrency);
|
|
||||||
if (result == -1) {
|
|
||||||
diff --git a/source/i18n/number_fluent.cpp b/source/i18n/number_fluent.cpp
|
|
||||||
index 45d6b06c6df..e6fe49f0dca 100644
|
|
||||||
--- a/source/i18n/number_fluent.cpp
|
|
||||||
+++ b/source/i18n/number_fluent.cpp
|
|
||||||
@@ -466,6 +466,7 @@ LocalizedNumberFormatter::LocalizedNumberFormatter(LocalizedNumberFormatter&& sr
|
|
||||||
|
|
||||||
LocalizedNumberFormatter::LocalizedNumberFormatter(NFS<LNF>&& src) noexcept
|
|
||||||
: NFS<LNF>(std::move(src)) {
|
|
||||||
+ // coverity[use_after_move]
|
|
||||||
lnfMoveHelper(std::move(static_cast<LNF&&>(src)));
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/source/i18n/number_padding.cpp b/source/i18n/number_padding.cpp
|
|
||||||
index c320c3ffb6f..3aa996f932f 100644
|
|
||||||
--- a/source/i18n/number_padding.cpp
|
|
||||||
+++ b/source/i18n/number_padding.cpp
|
|
||||||
@@ -29,6 +29,7 @@ addPaddingHelper(UChar32 paddingCp, int32_t requiredPadding, FormattedStringBuil
|
|
||||||
}
|
|
||||||
|
|
||||||
Padder::Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position) : fWidth(width) {
|
|
||||||
+ fUnion.errorCode = U_ZERO_ERROR; /* avoid coverity warning: "fUnion uninitialized" */
|
|
||||||
// TODO(13034): Consider making this a string instead of code point.
|
|
||||||
fUnion.padding.fCp = cp;
|
|
||||||
fUnion.padding.fPosition = position;
|
|
||||||
diff --git a/source/i18n/number_rounding.cpp b/source/i18n/number_rounding.cpp
|
|
||||||
index e6bb509ffd7..d9fe7d74275 100644
|
|
||||||
--- a/source/i18n/number_rounding.cpp
|
|
||||||
+++ b/source/i18n/number_rounding.cpp
|
|
||||||
@@ -284,6 +284,7 @@ FractionPrecision Precision::constructFraction(int32_t minFrac, int32_t maxFrac)
|
|
||||||
settings.fMinSig = -1;
|
|
||||||
settings.fMaxSig = -1;
|
|
||||||
PrecisionUnion union_;
|
|
||||||
+ /* coverity[uninit_use] */
|
|
||||||
union_.fracSig = settings;
|
|
||||||
return {RND_FRACTION, union_};
|
|
||||||
}
|
|
||||||
@@ -295,6 +296,7 @@ Precision Precision::constructSignificant(int32_t minSig, int32_t maxSig) {
|
|
||||||
settings.fMinSig = static_cast<digits_t>(minSig);
|
|
||||||
settings.fMaxSig = static_cast<digits_t>(maxSig);
|
|
||||||
PrecisionUnion union_;
|
|
||||||
+ /* coverity[uninit_use] */
|
|
||||||
union_.fracSig = settings;
|
|
||||||
return {RND_SIGNIFICANT, union_};
|
|
||||||
}
|
|
||||||
diff --git a/source/i18n/number_skeletons.cpp b/source/i18n/number_skeletons.cpp
|
|
||||||
index ef3befbffad..d790db5b92d 100644
|
|
||||||
--- a/source/i18n/number_skeletons.cpp
|
|
||||||
+++ b/source/i18n/number_skeletons.cpp
|
|
||||||
@@ -545,6 +545,7 @@ MacroProps skeleton::parseSkeleton(
|
|
||||||
segment.resetLength();
|
|
||||||
if (U_FAILURE(status)) {
|
|
||||||
errOffset = segment.getOffset();
|
|
||||||
+ /* coverity[uninit_use_in_call] */
|
|
||||||
return macros;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/source/i18n/numrange_fluent.cpp b/source/i18n/numrange_fluent.cpp
|
|
||||||
index 0944f3024ff..bdf179170a3 100644
|
|
||||||
--- a/source/i18n/numrange_fluent.cpp
|
|
||||||
+++ b/source/i18n/numrange_fluent.cpp
|
|
||||||
@@ -239,6 +239,7 @@ LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(LocalizedNumberRang
|
|
||||||
LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter(NFS<LNF>&& src) noexcept
|
|
||||||
: NFS<LNF>(std::move(src)) {
|
|
||||||
// Steal the compiled formatter
|
|
||||||
+ // coverity[use_after_move]
|
|
||||||
LNF&& _src = static_cast<LNF&&>(src);
|
|
||||||
auto* stolen = _src.fAtomicFormatter.exchange(nullptr);
|
|
||||||
delete fAtomicFormatter.exchange(stolen);
|
|
||||||
diff --git a/source/i18n/plurrule.cpp b/source/i18n/plurrule.cpp
|
|
||||||
index 839d14147cc..cc842347875 100644
|
|
||||||
--- a/source/i18n/plurrule.cpp
|
|
||||||
+++ b/source/i18n/plurrule.cpp
|
|
||||||
@@ -343,6 +343,7 @@ PluralRules::select(const number::impl::UFormattedNumberRangeData* impl, UErrorC
|
|
||||||
return ICU_Utility::makeBogusString();
|
|
||||||
}
|
|
||||||
auto result = mStandardPluralRanges->resolve(form1, form2);
|
|
||||||
+ /* coverity[overrun-call] */
|
|
||||||
return UnicodeString(StandardPlural::getKeyword(result), -1, US_INV);
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/source/i18n/rbt_pars.cpp b/source/i18n/rbt_pars.cpp
|
|
||||||
index c59a22faab2..1a49eaf12fb 100644
|
|
||||||
--- a/source/i18n/rbt_pars.cpp
|
|
||||||
+++ b/source/i18n/rbt_pars.cpp
|
|
||||||
@@ -1059,6 +1059,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
|
|
||||||
setVariableRange(0xF000, 0xF8FF, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /* coverity[overflow_sink] */
|
|
||||||
if (resemblesPragma(rule, pos, limit)) {
|
|
||||||
int32_t ppp = parsePragma(rule, pos, limit, status);
|
|
||||||
if (ppp < 0) {
|
|
||||||
diff --git a/source/i18n/tzgnames.cpp b/source/i18n/tzgnames.cpp
|
|
||||||
index d55b0fd2ae0..1e14003b22b 100644
|
|
||||||
--- a/source/i18n/tzgnames.cpp
|
|
||||||
+++ b/source/i18n/tzgnames.cpp
|
|
||||||
@@ -517,6 +517,7 @@ TZGNCore::getGenericLocationName(const UnicodeString& tzCanonicalID) {
|
|
||||||
char16_t tzIDKey[ZID_KEY_MAX + 1];
|
|
||||||
int32_t tzIDKeyLen = tzCanonicalID.extract(tzIDKey, ZID_KEY_MAX + 1, status);
|
|
||||||
U_ASSERT(status == U_ZERO_ERROR); // already checked length above
|
|
||||||
+ /* coverity[negative_returns] */
|
|
||||||
tzIDKey[tzIDKeyLen] = 0;
|
|
||||||
|
|
||||||
const char16_t *locname = (const char16_t *)uhash_get(fLocationNamesMap, tzIDKey);
|
|
||||||
diff --git a/source/i18n/vtzone.cpp b/source/i18n/vtzone.cpp
|
|
||||||
index 25af556aa22..7b557f1dab8 100644
|
|
||||||
--- a/source/i18n/vtzone.cpp
|
|
||||||
+++ b/source/i18n/vtzone.cpp
|
|
||||||
@@ -119,7 +119,7 @@ static UnicodeString& appendAsciiDigits(int32_t number, uint8_t length, UnicodeS
|
|
||||||
number *= -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- length = length > 10 ? 10 : length;
|
|
||||||
+ length = (uint8_t)((length > 10) ? 10 : length);
|
|
||||||
if (length == 0) {
|
|
||||||
// variable length
|
|
||||||
i = 0;
|
|
||||||
diff --git a/source/tools/gencnval/gencnval.c b/source/tools/gencnval/gencnval.c
|
|
||||||
index 54b41fb57da..129cf1fc451 100644
|
|
||||||
--- a/source/tools/gencnval/gencnval.c
|
|
||||||
+++ b/source/tools/gencnval/gencnval.c
|
|
||||||
@@ -273,6 +273,11 @@ main(int argc, char* argv[]) {
|
|
||||||
|
|
||||||
const char* sourcedir = options[SOURCEDIR].value;
|
|
||||||
if (sourcedir != NULL && *sourcedir != 0) {
|
|
||||||
+ if (strlen(sourcedir) + strlen(path) + 1 >= 512) {
|
|
||||||
+ fprintf(stderr,
|
|
||||||
+ "Length of sourcedir + path is too long, must be <= 510.\n");
|
|
||||||
+ exit(U_ILLEGAL_ARGUMENT_ERROR);
|
|
||||||
+ }
|
|
||||||
char *end;
|
|
||||||
uprv_strcpy(pathBuf, sourcedir);
|
|
||||||
end = uprv_strchr(pathBuf, 0);
|
|
||||||
diff --git a/source/tools/genrb/wrtxml.cpp b/source/tools/genrb/wrtxml.cpp
|
|
||||||
index 16f67fabcaf..cd0bb19bff7 100644
|
|
||||||
--- a/source/tools/genrb/wrtxml.cpp
|
|
||||||
+++ b/source/tools/genrb/wrtxml.cpp
|
|
||||||
@@ -187,7 +187,7 @@ static void strnrepchr(char* src, int32_t srcLen, char s, char r){
|
|
||||||
*/
|
|
||||||
static char* parseFilename(const char* id, char* /*lang*/) {
|
|
||||||
int idLen = (int) uprv_strlen(id);
|
|
||||||
- char* localeID = (char*) uprv_malloc(idLen);
|
|
||||||
+ char* localeID = (char*) uprv_malloc(idLen+1);
|
|
||||||
int pos = 0;
|
|
||||||
int canonCapacity = 0;
|
|
||||||
char* canon = nullptr;
|
|
||||||
diff --git a/source/tools/makeconv/makeconv.cpp b/source/tools/makeconv/makeconv.cpp
|
|
||||||
index b14b4316f3b..e47033f7c59 100644
|
|
||||||
--- a/source/tools/makeconv/makeconv.cpp
|
|
||||||
+++ b/source/tools/makeconv/makeconv.cpp
|
|
||||||
@@ -377,6 +377,10 @@ int main(int argc, char* argv[])
|
|
||||||
data.staticData.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (strlen(cnvName) + 1 > UPRV_LENGTHOF(data.staticData.name)) {
|
|
||||||
+ fprintf(stderr, "converter name %s too long\n", cnvName);
|
|
||||||
+ return U_BUFFER_OVERFLOW_ERROR;
|
|
||||||
+ }
|
|
||||||
uprv_strcpy((char*)data.staticData.name, cnvName);
|
|
||||||
|
|
||||||
if(!uprv_isInvariantString((char*)data.staticData.name, -1)) {
|
|
||||||
diff --git a/source/tools/toolutil/package.cpp b/source/tools/toolutil/package.cpp
|
|
||||||
index 3098f5d57d4..3bd28e48ac1 100644
|
|
||||||
--- a/source/tools/toolutil/package.cpp
|
|
||||||
+++ b/source/tools/toolutil/package.cpp
|
|
||||||
@@ -865,6 +865,7 @@ Package::writePackage(const char *filename, char outType, const char *comment) {
|
|
||||||
// write the items
|
|
||||||
for(pItem=items, i=0; i<itemCount; ++pItem, ++i) {
|
|
||||||
int32_t type=makeTypeEnum(pItem->type);
|
|
||||||
+ /* coverity[negative_returns] */
|
|
||||||
if(ds[type]!=nullptr) {
|
|
||||||
// swap each item from its platform properties to the desired ones
|
|
||||||
udata_swap(
|
|
||||||
diff --git a/source/tools/toolutil/ucbuf.cpp b/source/tools/toolutil/ucbuf.cpp
|
|
||||||
index 1eb54e260e6..1999433b003 100644
|
|
||||||
--- a/source/tools/toolutil/ucbuf.cpp
|
|
||||||
+++ b/source/tools/toolutil/ucbuf.cpp
|
|
||||||
@@ -257,7 +257,7 @@ ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* error){
|
|
||||||
|
|
||||||
/* for post-context */
|
|
||||||
start = pos+len;
|
|
||||||
- stop = (int32_t)(((pos+CONTEXT_LEN)<= (sourceLimit-cbuf) )? (pos+(CONTEXT_LEN-1)) : (sourceLimit-cbuf));
|
|
||||||
+ stop = (int32_t)(((pos+CONTEXT_LEN)<= (int32_t)(sourceLimit-cbuf) )? (pos+(CONTEXT_LEN-1)) : (int32_t)(sourceLimit-cbuf));
|
|
||||||
|
|
||||||
memcpy(postContext,source,stop-start);
|
|
||||||
/* null terminate the buffer */
|
|
||||||
--
|
|
||||||
2.46.2
|
|
||||||
|
|
@ -0,0 +1,453 @@
|
|||||||
|
diff -ru icu.orig/source/common/serv.cpp icu/source/common/serv.cpp
|
||||||
|
--- icu.orig/source/common/serv.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/common/serv.cpp 2021-08-18 13:04:50.838841089 +0200
|
||||||
|
@@ -532,12 +532,14 @@
|
||||||
|
}
|
||||||
|
UnicodeString* idToCache = new UnicodeString(currentDescriptor);
|
||||||
|
if (idToCache == NULL || idToCache->isBogus()) {
|
||||||
|
+ delete idToCache;
|
||||||
|
status = U_MEMORY_ALLOCATION_ERROR;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cacheDescriptorList._obj->addElement(idToCache, status);
|
||||||
|
if (U_FAILURE(status)) {
|
||||||
|
+ // delete idToCache;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} while (key.fallback());
|
||||||
|
diff -ru icu.orig/source/common/uloc_keytype.cpp icu/source/common/uloc_keytype.cpp
|
||||||
|
--- icu.orig/source/common/uloc_keytype.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/common/uloc_keytype.cpp 2021-08-18 14:03:41.707324553 +0200
|
||||||
|
@@ -331,6 +331,10 @@
|
||||||
|
LocExtKeyData* keyData = gLocExtKeyDataEntries->create();
|
||||||
|
if (keyData == NULL) {
|
||||||
|
sts = U_MEMORY_ALLOCATION_ERROR;
|
||||||
|
+ if (typeDataMap != NULL) {
|
||||||
|
+ uhash_close(typeDataMap);
|
||||||
|
+ typeDataMap = NULL;
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
keyData->bcpId = bcpKeyId;
|
||||||
|
diff -ru icu.orig/source/common/umutablecptrie.cpp icu/source/common/umutablecptrie.cpp
|
||||||
|
--- icu.orig/source/common/umutablecptrie.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/common/umutablecptrie.cpp 2021-08-18 13:59:02.507170287 +0200
|
||||||
|
@@ -1543,7 +1543,7 @@
|
||||||
|
MixedBlocks mixedBlocks;
|
||||||
|
int32_t newDataLength = compactData(fastILimit, newData, newDataCapacity,
|
||||||
|
dataNullIndex, mixedBlocks, errorCode);
|
||||||
|
- if (U_FAILURE(errorCode)) { return 0; }
|
||||||
|
+ if (U_FAILURE(errorCode)) { uprv_free(newData); return 0; }
|
||||||
|
U_ASSERT(newDataLength <= newDataCapacity);
|
||||||
|
uprv_free(data);
|
||||||
|
data = newData;
|
||||||
|
diff -ru icu.orig/source/i18n/rbt_pars.cpp icu/source/i18n/rbt_pars.cpp
|
||||||
|
--- icu.orig/source/i18n/rbt_pars.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/i18n/rbt_pars.cpp 2021-08-18 16:03:45.537119292 +0200
|
||||||
|
@@ -557,6 +557,7 @@
|
||||||
|
// The next character MUST be a segment open
|
||||||
|
if (single == NULL ||
|
||||||
|
!ICU_Utility::parseChar(rule, iref, SEGMENT_OPEN)) {
|
||||||
|
+ delete single;
|
||||||
|
return syntaxError(U_INVALID_FUNCTION, rule, start, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -ru icu.orig/source/i18n/tridpars.cpp icu/source/i18n/tridpars.cpp
|
||||||
|
--- icu.orig/source/i18n/tridpars.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/i18n/tridpars.cpp 2021-08-18 16:08:57.727071891 +0200
|
||||||
|
@@ -136,6 +136,9 @@
|
||||||
|
specsB = parseFilterID(id, pos, TRUE);
|
||||||
|
// Must close with a ')'
|
||||||
|
if (specsB == NULL || !ICU_Utility::parseChar(id, pos, CLOSE_REV)) {
|
||||||
|
+ if (specsB != NULL) {
|
||||||
|
+ delete specsB;
|
||||||
|
+ }
|
||||||
|
delete specsA;
|
||||||
|
pos = start;
|
||||||
|
return NULL;
|
||||||
|
diff -ru icu.orig/source/i18n/usearch.cpp icu/source/i18n/usearch.cpp
|
||||||
|
--- icu.orig/source/i18n/usearch.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/i18n/usearch.cpp 2021-08-18 16:19:31.533900708 +0200
|
||||||
|
@@ -222,6 +222,9 @@
|
||||||
|
int32_t *temp = (int32_t *)allocateMemory(
|
||||||
|
sizeof(int32_t) * newlength, status);
|
||||||
|
if (U_FAILURE(*status)) {
|
||||||
|
+ if (temp != NULL) {
|
||||||
|
+ uprv_free(temp);
|
||||||
|
+ }
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
uprv_memcpy(temp, destination, sizeof(int32_t) * (size_t)offset);
|
||||||
|
diff -ru icu.orig/source/i18n/usearch.cpp icu/source/i18n/usearch.cpp
|
||||||
|
--- icu.orig/source/i18n/usearch.cpp 2021-08-18 16:23:27.961337248 +0200
|
||||||
|
+++ icu/source/i18n/usearch.cpp 2021-08-18 16:27:47.140623351 +0200
|
||||||
|
@@ -266,6 +266,9 @@
|
||||||
|
sizeof(int64_t) * newlength, status);
|
||||||
|
|
||||||
|
if (U_FAILURE(*status)) {
|
||||||
|
+ if (temp != NULL) {
|
||||||
|
+ uprv_free(temp);
|
||||||
|
+ }
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -ru icu.orig/source/i18n/uspoof_impl.cpp icu/source/i18n/uspoof_impl.cpp
|
||||||
|
--- icu.orig/source/i18n/uspoof_impl.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/i18n/uspoof_impl.cpp 2021-08-18 16:30:43.061460025 +0200
|
||||||
|
@@ -196,6 +196,9 @@
|
||||||
|
tmpSet = allowedChars.clone();
|
||||||
|
const char *tmpLocalesList = uprv_strdup(localesList);
|
||||||
|
if (tmpSet == NULL || tmpLocalesList == NULL) {
|
||||||
|
+ if (tmpLocalesList != NULL) {
|
||||||
|
+ uprv_free((void *)tmpLocalesList);
|
||||||
|
+ }
|
||||||
|
status = U_MEMORY_ALLOCATION_ERROR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
diff -ru icu.orig/source/common/loclikely.cpp icu/source/common/loclikely.cpp
|
||||||
|
--- icu.orig/source/common/loclikely.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/common/loclikely.cpp 2021-08-18 16:59:05.786257032 +0200
|
||||||
|
@@ -1351,7 +1351,9 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- rgBuf[rgLen] = 0;
|
||||||
|
+ if (rgLen >= 0) {
|
||||||
|
+ rgBuf[rgLen] = 0;
|
||||||
|
+ }
|
||||||
|
uprv_strncpy(region, rgBuf, regionCapacity);
|
||||||
|
return u_terminateChars(region, regionCapacity, rgLen, status);
|
||||||
|
}
|
||||||
|
diff -ru icu.orig/source/common/lsr.cpp icu/source/common/lsr.cpp
|
||||||
|
--- icu.orig/source/common/lsr.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/common/lsr.cpp 2021-08-18 17:39:36.706794880 +0200
|
||||||
|
@@ -89,13 +89,15 @@
|
||||||
|
int32_t b = region[1] - '0';
|
||||||
|
if (b < 0 || 9 < b) { return 0; }
|
||||||
|
c = region[2] - '0';
|
||||||
|
- if (c < 0 || 9 < c || region[3] != 0) { return 0; }
|
||||||
|
+ if (uprv_strlen(region) > 3) { return 0; }
|
||||||
|
+ if (c < 0 || 9 < c) { return 0; }
|
||||||
|
return (10 * a + b) * 10 + c + 1;
|
||||||
|
} else { // letters: "DE"
|
||||||
|
a = uprv_upperOrdinal(c);
|
||||||
|
if (a < 0 || 25 < a) { return 0; }
|
||||||
|
int32_t b = uprv_upperOrdinal(region[1]);
|
||||||
|
- if (b < 0 || 25 < b || region[2] != 0) { return 0; }
|
||||||
|
+ if (uprv_strlen(region) > 2) { return 0; }
|
||||||
|
+ if (b < 0 || 25 < b) { return 0; }
|
||||||
|
return 26 * a + b + 1001;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
diff -ru icu.orig/source/tools/toolutil/filetools.cpp icu/source/tools/toolutil/filetools.cpp
|
||||||
|
--- icu.orig/source/tools/toolutil/filetools.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/tools/toolutil/filetools.cpp 2021-08-19 09:56:56.393333089 +0200
|
||||||
|
@@ -64,6 +64,7 @@
|
||||||
|
newpath.append(dirEntry->d_name, -1, status);
|
||||||
|
if (U_FAILURE(status)) {
|
||||||
|
fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, u_errorName(status));
|
||||||
|
+ closedir(pDir);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
diff -ru icu.orig/source/tools/pkgdata/pkgtypes.c icu/source/tools/pkgdata/pkgtypes.c
|
||||||
|
--- icu.orig/source/tools/pkgdata/pkgtypes.c 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/tools/pkgdata/pkgtypes.c 2021-08-19 10:37:07.400622046 +0200
|
||||||
|
@@ -30,6 +30,7 @@
|
||||||
|
{
|
||||||
|
int32_t ln = 0;
|
||||||
|
char buffer[1024];
|
||||||
|
+ char *bufferp = buffer;
|
||||||
|
while(l != NULL)
|
||||||
|
{
|
||||||
|
if(l->str)
|
||||||
|
@@ -42,7 +43,7 @@
|
||||||
|
buffer[uprv_strlen(buffer)-1] = '\0';
|
||||||
|
}
|
||||||
|
if(buffer[0] == '"') {
|
||||||
|
- uprv_strcpy(buffer, buffer+1);
|
||||||
|
+ bufferp = buffer+1;
|
||||||
|
}
|
||||||
|
} else if(quote > 0) { /* add quotes */
|
||||||
|
if(l->str[0] != '"') {
|
||||||
|
@@ -53,7 +54,7 @@
|
||||||
|
uprv_strcat(buffer, "\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- T_FileStream_write(s, buffer, (int32_t)uprv_strlen(buffer));
|
||||||
|
+ T_FileStream_write(s, bufferp, (int32_t)uprv_strlen(bufferp));
|
||||||
|
|
||||||
|
ln += (int32_t)uprv_strlen(l->str);
|
||||||
|
}
|
||||||
|
@@ -74,7 +75,8 @@
|
||||||
|
|
||||||
|
const char *pkg_writeCharList(FileStream *s, CharList *l, const char *delim, int32_t quote)
|
||||||
|
{
|
||||||
|
- char buffer[1024];
|
||||||
|
+ char buffer[1026]; /* 1026 instead of 1024 because quotes may be added */
|
||||||
|
+ char *bufferp = buffer;
|
||||||
|
while(l != NULL)
|
||||||
|
{
|
||||||
|
if(l->str)
|
||||||
|
@@ -92,7 +94,7 @@
|
||||||
|
buffer[uprv_strlen(buffer)-1] = '\0';
|
||||||
|
}
|
||||||
|
if(buffer[0] == '"') {
|
||||||
|
- uprv_strcpy(buffer, buffer+1);
|
||||||
|
+ bufferp = buffer+1;
|
||||||
|
}
|
||||||
|
} else if(quote > 0) { /* add quotes */
|
||||||
|
if(l->str[0] != '"') {
|
||||||
|
@@ -103,7 +105,7 @@
|
||||||
|
uprv_strcat(buffer, "\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- T_FileStream_write(s, buffer, (int32_t)uprv_strlen(buffer));
|
||||||
|
+ T_FileStream_write(s, bufferp, (int32_t)uprv_strlen(bufferp));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(l->next && delim)
|
||||||
|
diff -ru icu.orig/source/tools/pkgdata/pkgdata.cpp icu/source/tools/pkgdata/pkgdata.cpp
|
||||||
|
--- icu.orig/source/tools/pkgdata/pkgdata.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/tools/pkgdata/pkgdata.cpp 2021-08-19 11:11:35.563339463 +0200
|
||||||
|
@@ -980,12 +980,12 @@
|
||||||
|
version_major);
|
||||||
|
#else
|
||||||
|
if (noVersion && !reverseExt) {
|
||||||
|
- sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s",
|
||||||
|
+ snprintf(libFileNames[LIB_FILE_VERSION_TMP], sizeof(libFileNames[LIB_FILE_VERSION_TMP]), "%s%s%s",
|
||||||
|
libFileNames[LIB_FILE],
|
||||||
|
FILE_SUFFIX,
|
||||||
|
pkgDataFlags[SOBJ_EXT]);
|
||||||
|
} else {
|
||||||
|
- sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s%s%s",
|
||||||
|
+ snprintf(libFileNames[LIB_FILE_VERSION_TMP], sizeof(libFileNames[LIB_FILE_VERSION_TMP]), "%s%s%s%s%s",
|
||||||
|
libFileNames[LIB_FILE],
|
||||||
|
FILE_SUFFIX,
|
||||||
|
reverseExt ? version : pkgDataFlags[SOBJ_EXT],
|
||||||
|
@@ -994,24 +994,24 @@
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (noVersion && !reverseExt) {
|
||||||
|
- sprintf(libFileNames[LIB_FILE_VERSION_MAJOR], "%s%s%s",
|
||||||
|
+ snprintf(libFileNames[LIB_FILE_VERSION_MAJOR], sizeof(libFileNames[LIB_FILE_VERSION_MAJOR]), "%s%s%s",
|
||||||
|
libFileNames[LIB_FILE],
|
||||||
|
FILE_SUFFIX,
|
||||||
|
pkgDataFlags[SO_EXT]);
|
||||||
|
|
||||||
|
- sprintf(libFileNames[LIB_FILE_VERSION], "%s%s%s",
|
||||||
|
+ snprintf(libFileNames[LIB_FILE_VERSION], sizeof(libFileNames[LIB_FILE_VERSION]), "%s%s%s",
|
||||||
|
libFileNames[LIB_FILE],
|
||||||
|
FILE_SUFFIX,
|
||||||
|
pkgDataFlags[SO_EXT]);
|
||||||
|
} else {
|
||||||
|
- sprintf(libFileNames[LIB_FILE_VERSION_MAJOR], "%s%s%s%s%s",
|
||||||
|
+ snprintf(libFileNames[LIB_FILE_VERSION_MAJOR], sizeof(libFileNames[LIB_FILE_VERSION_MAJOR]), "%s%s%s%s%s",
|
||||||
|
libFileNames[LIB_FILE],
|
||||||
|
FILE_SUFFIX,
|
||||||
|
reverseExt ? version_major : pkgDataFlags[SO_EXT],
|
||||||
|
FILE_EXTENSION_SEP,
|
||||||
|
reverseExt ? pkgDataFlags[SO_EXT] : version_major);
|
||||||
|
|
||||||
|
- sprintf(libFileNames[LIB_FILE_VERSION], "%s%s%s%s%s",
|
||||||
|
+ snprintf(libFileNames[LIB_FILE_VERSION], sizeof(libFileNames[LIB_FILE_VERSION]), "%s%s%s%s%s",
|
||||||
|
libFileNames[LIB_FILE],
|
||||||
|
FILE_SUFFIX,
|
||||||
|
reverseExt ? version : pkgDataFlags[SO_EXT],
|
||||||
|
@@ -1029,7 +1029,7 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(IN_STATIC_MODE(mode)) {
|
||||||
|
- sprintf(libFileNames[LIB_FILE_VERSION], "%s.%s", libFileNames[LIB_FILE], pkgDataFlags[A_EXT]);
|
||||||
|
+ snprintf(libFileNames[LIB_FILE_VERSION], sizeof(libFileNames[LIB_FILE_VERSION]), "%s.%s", libFileNames[LIB_FILE], pkgDataFlags[A_EXT]);
|
||||||
|
libFileNames[LIB_FILE_VERSION_MAJOR][0]=0;
|
||||||
|
if(o->verbose) {
|
||||||
|
fprintf(stdout, "# libFileName[LIB_FILE_VERSION] = %s (static)\n", libFileNames[LIB_FILE_VERSION]);
|
||||||
|
@@ -1308,7 +1308,7 @@
|
||||||
|
* archive file suffix is the same, then the final library needs to be archived.
|
||||||
|
*/
|
||||||
|
if (uprv_strcmp(pkgDataFlags[SOBJ_EXT], pkgDataFlags[SO_EXT]) != 0 && uprv_strcmp(pkgDataFlags[A_EXT], pkgDataFlags[SO_EXT]) == 0) {
|
||||||
|
- sprintf(libFileNames[LIB_FILE_VERSION], "%s%s%s.%s",
|
||||||
|
+ snprintf(libFileNames[LIB_FILE_VERSION], sizeof(libFileNames[LIB_FILE_VERSION]), "%s%s%s.%s",
|
||||||
|
libFileNames[LIB_FILE],
|
||||||
|
pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "",
|
||||||
|
reverseExt ? version : pkgDataFlags[SO_EXT],
|
||||||
|
diff -ru icu.orig/source/tools/ctestfw/ctest.c icu/source/tools/ctestfw/ctest.c
|
||||||
|
--- icu.orig/source/tools/ctestfw/ctest.c 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/tools/ctestfw/ctest.c 2021-08-19 13:19:21.016799737 +0200
|
||||||
|
@@ -686,7 +686,6 @@
|
||||||
|
}
|
||||||
|
vfprintf(stdout, pattern, ap);
|
||||||
|
fflush(stdout);
|
||||||
|
- va_end(ap);
|
||||||
|
if((*pattern==0) || (pattern[strlen(pattern)-1]!='\n')) {
|
||||||
|
HANGING_OUTPUT=1;
|
||||||
|
} else {
|
||||||
|
@@ -728,7 +727,6 @@
|
||||||
|
}
|
||||||
|
vfprintf(stdout, pattern, ap);
|
||||||
|
fflush(stdout);
|
||||||
|
- va_end(ap);
|
||||||
|
if((*pattern==0) || (pattern[strlen(pattern)-1]!='\n')) {
|
||||||
|
HANGING_OUTPUT=1;
|
||||||
|
} else {
|
||||||
|
@@ -777,7 +775,6 @@
|
||||||
|
}
|
||||||
|
vfprintf(stdout, pattern, ap);
|
||||||
|
fflush(stdout);
|
||||||
|
- va_end(ap);
|
||||||
|
GLOBAL_PRINT_COUNT++;
|
||||||
|
if((*pattern==0) || (pattern[strlen(pattern)-1]!='\n')) {
|
||||||
|
HANGING_OUTPUT=1;
|
||||||
|
@@ -803,6 +800,7 @@
|
||||||
|
}
|
||||||
|
va_start(ap, pattern);
|
||||||
|
vlog_err(NULL, pattern, ap);
|
||||||
|
+ va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
UBool T_CTEST_EXPORT2
|
||||||
|
@@ -806,8 +806,11 @@
|
||||||
|
UBool T_CTEST_EXPORT2
|
||||||
|
log_knownIssue(const char *ticket, const char *pattern, ...) {
|
||||||
|
va_list ap;
|
||||||
|
+ UBool result;
|
||||||
|
va_start(ap, pattern);
|
||||||
|
- return vlog_knownIssue(ticket, pattern, ap);
|
||||||
|
+ result = vlog_knownIssue(ticket, pattern, ap);
|
||||||
|
+ va_end(ap);
|
||||||
|
+ return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_CTEST_EXPORT2
|
||||||
|
@@ -843,6 +842,7 @@
|
||||||
|
}
|
||||||
|
vlog_err(NULL, pattern, ap); /* no need for prefix in default case */
|
||||||
|
}
|
||||||
|
+ va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_CTEST_EXPORT2
|
||||||
|
@@ -852,6 +852,7 @@
|
||||||
|
|
||||||
|
va_start(ap, pattern);
|
||||||
|
vlog_info(NULL, pattern, ap);
|
||||||
|
+ va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void T_CTEST_EXPORT2
|
||||||
|
@@ -861,6 +862,7 @@
|
||||||
|
|
||||||
|
va_start(ap, pattern);
|
||||||
|
vlog_verbose(NULL, pattern, ap);
|
||||||
|
+ va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -882,6 +884,7 @@
|
||||||
|
} else {
|
||||||
|
vlog_info("[DATA] ", pattern, ap);
|
||||||
|
}
|
||||||
|
+ va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
diff -ru icu/source/tools/gensprep/store.c icu.new/source/tools/gensprep/store.c
|
||||||
|
--- icu/source/tools/gensprep/store.c 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu.new/source/tools/gensprep/store.c 2021-08-19 16:16:17.213687755 +0200
|
||||||
|
@@ -636,7 +636,6 @@
|
||||||
|
cleanUpData(void) {
|
||||||
|
uprv_free(mappingData);
|
||||||
|
utrie_close(sprepTrie);
|
||||||
|
- uprv_free(sprepTrie);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* #if !UCONFIG_NO_IDNA */
|
||||||
|
diff -ru icu.orig/source/common/uloc_tag.cpp icu/source/common/uloc_tag.cpp
|
||||||
|
--- icu.orig/source/common/uloc_tag.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/common/uloc_tag.cpp 2021-08-19 16:32:26.948185554 +0200
|
||||||
|
@@ -2254,6 +2254,7 @@
|
||||||
|
var = (VariantListEntry*)uprv_malloc(sizeof(VariantListEntry));
|
||||||
|
if (var == NULL) {
|
||||||
|
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||||
|
+ uprv_free(pExtension);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
*pSep = 0;
|
||||||
|
diff -ru icu.orig/source/common/uloc_keytype.cpp icu/source/common/uloc_keytype.cpp
|
||||||
|
--- icu.orig/source/common/uloc_keytype.cpp 2021-08-19 16:34:07.037514442 +0200
|
||||||
|
+++ icu/source/common/uloc_keytype.cpp 2021-08-19 16:37:38.276098078 +0200
|
||||||
|
@@ -325,6 +325,10 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (U_FAILURE(sts)) {
|
||||||
|
+ if (typeDataMap != NULL) {
|
||||||
|
+ uhash_close(typeDataMap);
|
||||||
|
+ typeDataMap = NULL;
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -ru icu.orig/source/common/serv.cpp icu/source/common/serv.cpp
|
||||||
|
--- icu.orig/source/common/serv.cpp 2021-08-19 20:45:49.923742619 +0200
|
||||||
|
+++ icu/source/common/serv.cpp 2021-08-20 13:16:04.401298668 +0200
|
||||||
|
@@ -793,6 +793,7 @@
|
||||||
|
*/
|
||||||
|
int32_t pos = UHASH_FIRST;
|
||||||
|
const UHashElement *entry = NULL;
|
||||||
|
+ /* coverity[deref_after_free] */
|
||||||
|
while ((entry = dnCache->cache.nextElement(pos)) != NULL) {
|
||||||
|
const UnicodeString* id = (const UnicodeString*)entry->value.pointer;
|
||||||
|
if (matchKey != NULL && !matchKey->isFallbackOf(*id)) {
|
||||||
|
diff -ru icu.orig/source/i18n/decNumber.h icu/source/i18n/decNumber.h
|
||||||
|
--- icu.orig/source/i18n/decNumber.h 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/i18n/decNumber.h 2021-08-20 13:17:27.208783404 +0200
|
||||||
|
@@ -86,7 +86,7 @@
|
||||||
|
/* range: -1999999997 through 999999999 */
|
||||||
|
uint8_t bits; /* Indicator bits (see above) */
|
||||||
|
/* Coefficient, from least significant unit */
|
||||||
|
- decNumberUnit lsu[DECNUMUNITS];
|
||||||
|
+ decNumberUnit lsu[DECNUMUNITS+2];
|
||||||
|
} decNumber;
|
||||||
|
|
||||||
|
/* Notes: */
|
||||||
|
diff -ru icu.orig/source/tools/makeconv/genmbcs.cpp icu/source/tools/makeconv/genmbcs.cpp
|
||||||
|
--- icu.orig/source/tools/makeconv/genmbcs.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/tools/makeconv/genmbcs.cpp 2021-08-23 08:07:02.972087418 +0200
|
||||||
|
@@ -172,7 +172,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
MBCSInit(mbcsData, ucm);
|
||||||
|
- return &mbcsData->newConverter;
|
||||||
|
+ return (NewConverter *)mbcsData;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
diff -ru icu.orig/source/common/brkiter.cpp icu/source/common/brkiter.cpp
|
||||||
|
--- icu.orig/source/common/brkiter.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/common/brkiter.cpp 2021-08-23 13:56:11.644603960 +0200
|
||||||
|
@@ -105,7 +105,9 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* coverity[incorrect_free] */
|
||||||
|
ures_close(brkRules);
|
||||||
|
+ /* coverity[incorrect_free] */
|
||||||
|
ures_close(brkName);
|
||||||
|
|
||||||
|
UDataMemory* file = udata_open(U_ICUDATA_BRKITR, ext, fnbuff, &status);
|
||||||
|
diff -ru icu.orig/source/common/uresbund.cpp icu/source/common/uresbund.cpp
|
||||||
|
--- icu.orig/source/common/uresbund.cpp 2020-04-22 22:04:20.000000000 +0200
|
||||||
|
+++ icu/source/common/uresbund.cpp 2021-08-23 13:56:53.329339657 +0200
|
||||||
|
@@ -2493,7 +2493,9 @@
|
||||||
|
static void U_CALLCONV
|
||||||
|
ures_loc_closeLocales(UEnumeration *enumerator) {
|
||||||
|
ULocalesContext *ctx = (ULocalesContext *)enumerator->context;
|
||||||
|
+ /* coverity[address_free] */
|
||||||
|
ures_close(&ctx->curr);
|
||||||
|
+ /* coverity[address_free] */
|
||||||
|
ures_close(&ctx->installed);
|
||||||
|
uprv_free(ctx);
|
||||||
|
uprv_free(enumerator);
|
Loading…
Reference in new issue