]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix multibyte issue in ltree_strncasecmp().
authorJeff Davis <jdavis@postgresql.org>
Tue, 16 Dec 2025 18:35:40 +0000 (10:35 -0800)
committerJeff Davis <jdavis@postgresql.org>
Tue, 16 Dec 2025 18:36:29 +0000 (10:36 -0800)
commitb8cfe9dc2e7f052e727fc3bc07ccaef13ef55979
tree7e99208f1077dbc7a8d0b3d27fd37c88aade8b76
parent1d0fc2499ff2f7b81e1e2c742ccb587c48d0f6d6
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
contrib/ltree/lquery_op.c
contrib/ltree/ltree.h
contrib/ltree/ltxtquery_op.c