Re: pgsql: Unicode case mapping tables and functions.

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Jeff Davis <jdavis(at)postgresql(dot)org>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Unicode case mapping tables and functions.
Date: 2024-03-08 08:24:52
Message-ID: b20d6d97-7338-48ea-ba33-837a1c8ef98e@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On 07/03/2024 21:18, Jeff Davis wrote:
> Unicode case mapping tables and functions.

With -Wtype-limits, I'm seeing this warning:

unicode_case.c: In function ‘convert_case’:
unicode_case.c:107:47: warning: comparison of unsigned expression in ‘<
0’ is always false [-Wtype-limits]
107 | while (src[srcoff] != '\0' && (srclen < 0 || srcoff <
srclen))
| ^

That seems like legit issue. The comment in unicode_strlower/upper() says:

> * String src must be encoded in UTF-8. If srclen < 0, src must be
> * NUL-terminated.

But srclen is of type size_t, which is unsigned.

--
Heikki Linnakangas
Neon (https://neon.tech)

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2024-03-08 11:19:14 pgsql: Avoid stack overflow in ShowTransactionStateRec()
Previous Message John Naylor 2024-03-08 04:13:56 Re: pgsql: Add template for adaptive radix tree