pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix multibyte issue in ltree_strncasecmp().
Date: Tue, 16 Dec 2025 18:49:40 +0000
Message-ID: <E1vVa79-0016xX-2Z@gemulon.postgresql.org> (raw)

Fix multibyte issue in ltree_strncasecmp().

Previously, the API for ltree_strncasecmp() took two inputs but only
one length (that of the smaller input). It truncated the larger input
to that length, but that could break a multibyte sequence.

Change the API to be a check for prefix equality (possibly
case-insensitive) instead, which is all that's needed by the
callers. Also, provide the lengths of both inputs.

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/5f65b85740197ba6249ea507cddf609f84a6188b.camel%40j-davis.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/335b2f30b468c133f86891ec3d82a2fd0d50e221

Modified Files
--------------
contrib/ltree/lquery_op.c    | 40 ++++++++++++++++++++++++++++------------
contrib/ltree/ltree.h        |  9 ++++++---
contrib/ltree/ltxtquery_op.c |  8 ++++----
3 files changed, 38 insertions(+), 19 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1vVa79-0016xX-2Z@gemulon.postgresql.org>
Permalink:  ../E1vVa79-0016xX-2Z@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vVa79-0016xX-2Z@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix multibyte issue in ltree_strncasecmp().
  In-Reply-To: <E1vVa79-0016xX-2Z@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox