Re: BUG #17584: SQL crashes PostgreSQL when using ICU collation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: James Inform <james(dot)inform(at)pharmapp(dot)de>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Euler Taveira <euler(at)eulerto(dot)com>
Subject: Re: BUG #17584: SQL crashes PostgreSQL when using ICU collation
Date: 2022-08-14 14:25:32
Message-ID: 651207.1660487132@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Peter Geoghegan <pg(at)bowt(dot)ie> writes:
> On Sat, Aug 13, 2022 at 11:15 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> How can we only be reaching this function with sss->collate_c true
>> when the prevailing locale isn't that?

> We don't trust libc's strxfrm() following the debacle with
> locale-aware abbreviated keys back in 2016 (unless the user builds
> their own Postgres, and goes out of their way to #define
> TRUST_STRXFRM). So the relevant strxfrm() code is arguably dead code.
>
> ICU is different: our policy with ICU locales has always been to trust
> ICU's strxfrm()-like function to agree with ICU's strcoll()-like
> function.

Ah ... so that explains the OP's observation that this is only
seen with ICU locales.

When I build with --with-icu and run coverage testing on the core
regression tests under LANG=en_US.utf8, I see that most of
varstr_abbrev_convert() is reached, but *not* the two buggy
buffer-enlargement stanzas. So that explains why we've not seen this
in testing. I wonder whether there is a reasonably cheap way to test
that. The submitted test case is clearly out of the question to add
as a regression test...

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniele Varrazzo 2022-08-14 14:26:43 Regression in pipeline mode in libpq 14.5
Previous Message Tom Lane 2022-08-14 14:08:55 Re: COPY TO CSV produces data that is incompatible/unsafe for \COPY FROM CSV