public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ayush Tiwari <[email protected]>
To: Jeff Davis <[email protected]>
Cc: [email protected]
Subject: Re: Add a guard against uninitialized default locale
Date: Fri, 15 May 2026 09:12:11 +0530
Message-ID: <CAJTYsWVg5j_UA8mcNTWcQnhePxyd_DLZT7QDQv54dvcG=900Jg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>

Hi,

On Fri, 15 May 2026 at 03:30, Jeff Davis <[email protected]> wrote:

> On Fri, 2026-04-24 at 15:44 -0700, Jeff Davis wrote:
> > Not known to be reachable after dbf217c1c7, but defend against
> > similar
> > issues in the future. For instance, an extension might encounter the
> > problem by calling pg_newlocale_from_collation(DEFAULT_COLLATION_OID)
> > from _PG_init(), and end up with a NULL pointer dereference.
> >
> > Backport through 17, though patch is different in 17 (also attached).
>
> I plan to commit and backport this soon.
>
>
The patch looks good to me as it is.

Just one nit in PG 17 patch:

   The provider == '\0' sentinel is correct (valid
   providers are 'b'/'c'/'i'/'d', all nonzero) and the three guarded
   sites (lc_collate_is_c, lc_ctype_is_c, pg_newlocale_from_collation)
   cover the direct consumers symmetrically.  The only thing maybe
   consider is replacing the bare /* should not happen */ above the
   '\0' test with something like /* provider unset; init_database_-
   collation() not yet run */ -- the literal '\0' check reads as a bit
   magical otherwise, but maybe you are doing that to have same
   comment throughout.

Regards,
Ayush


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]
  Subject: Re: Add a guard against uninitialized default locale
  In-Reply-To: <CAJTYsWVg5j_UA8mcNTWcQnhePxyd_DLZT7QDQv54dvcG=900Jg@mail.gmail.com>

* 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