Re: pgsql: Unicode case mapping tables and functions. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject Re: pgsql: Unicode case mapping tables and functions.
Date
Msg-id b20d6d97-7338-48ea-ba33-837a1c8ef98e@iki.fi
Whole thread Raw
In response to pgsql: Unicode case mapping tables and functions.  (Jeff Davis <jdavis@postgresql.org>)
Responses Re: pgsql: Unicode case mapping tables and functions.
List 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)




pgsql-committers by date:

Previous
From: John Naylor
Date:
Subject: Re: pgsql: Add template for adaptive radix tree
Next
From: Alexander Korotkov
Date:
Subject: pgsql: Turn tail recursion into iteration in CommitTransactionCommand()