public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andreas Karlsson <[email protected]>
To: Jeff Davis <[email protected]>
To: Alexander Lakhin <[email protected]>
To: zengman <[email protected]>
To: pgsql-hackers <[email protected]>
Subject: Re: Speed up ICU case conversion by using ucasemap_utf8To*()
Date: Tue, 14 Apr 2026 02:20:25 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
On 4/13/26 20:40, Jeff Davis wrote:
> Thank you both!
Thanks!
> Committed with minor revisions:
>
> * also check the status code, just to be sure
If we do that shouldn't we also do the same in the other callsites in
initdb.c uloc_getLanguage()? Maybe something like the attached. Also I
wonder if maybe other ICU functions have the same risk.
Andreas
Attachments:
[text/x-patch] v1-0001-Always-check-for-untermianted-strings-when-callin.patch (1.2K, 2-v1-0001-Always-check-for-untermianted-strings-when-callin.patch)
download | inline diff:
From 86703cae627f2d1a12fecb3a6ab7fbc0f0511330 Mon Sep 17 00:00:00 2001
From: Andreas Karlsson <[email protected]>
Date: Tue, 14 Apr 2026 02:12:15 +0200
Subject: [PATCH v1] Always check for untermianted strings when calling
uloc_getLanguage()
---
src/bin/initdb/initdb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 509f1114ef6..21f25915ab2 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -2403,7 +2403,7 @@ icu_validate_locale(const char *loc_str)
/* validate that we can extract the language */
status = U_ZERO_ERROR;
uloc_getLanguage(loc_str, lang, ULOC_LANG_CAPACITY, &status);
- if (U_FAILURE(status))
+ if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING)
{
pg_fatal("could not get language from locale \"%s\": %s",
loc_str, u_errorName(status));
@@ -2423,7 +2423,7 @@ icu_validate_locale(const char *loc_str)
status = U_ZERO_ERROR;
uloc_getLanguage(otherloc, otherlang, ULOC_LANG_CAPACITY, &status);
- if (U_FAILURE(status))
+ if (U_FAILURE(status) || status === U_STRING_NOT_TERMINATED_WARNING)
continue;
if (strcmp(lang, otherlang) == 0)
--
2.43.0
view thread (15+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Speed up ICU case conversion by using ucasemap_utf8To*()
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox