Re: Speed up ICU case conversion by using ucasemap_utf8To*()

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Andreas Karlsson <andreas(at)proxel(dot)se>, Alexander Lakhin <exclusion(at)gmail(dot)com>, zengman <zengman(at)halodbtech(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Speed up ICU case conversion by using ucasemap_utf8To*()
Date: 2026-04-13 18:40:03
Message-ID: 84006e443ef2dcfcbff8dcb3814c0c402b8ff7fd.camel@j-davis.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2026-04-01 at 02:46 +0200, Andreas Karlsson wrote:
> On 3/12/26 5:00 AM, Alexander Lakhin wrote:
> > I've discovered that starting from c4ff35f10, the following query:
> > CREATE COLLATION c (provider = icu, locale = 'icu_something');
> >
> > makes asan detect (maybe dubious, but still..) stack-buffer-
> > overflow:
> > ==21963==ERROR: AddressSanitizer: stack-buffer-overflow on address
>
> My proposed fix is that we allocate a ULOC_LANG_CAPACITY buffer for
> the
> language like we do in fix_icu_locale_str() instead of trying to be
> clever.

Thank you both!

Committed with minor revisions:

* also check the status code, just to be sure
* backport to 18 where the original code was introduced

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-04-13 18:50:31 Re: test_compression, test module for low-level compression APIs (for 2b5ba2a0a141)
Previous Message Bertrand Drouvot 2026-04-13 17:15:52 Re: Reduce build times of pg_trgm GIN indexes