Re: Fixes bug in strlower_libc_sb()

Поиск
Список
Период
Сортировка
От Bertrand Drouvot
Тема Re: Fixes bug in strlower_libc_sb()
Дата
Msg-id aScnhfrMQ5r444GU@ip-10-97-1-34.eu-west-3.compute.internal
обсуждение исходный текст
Ответ на Re: Fixes bug in strlower_libc_sb()  (Chao Li <li.evan.chao@gmail.com>)
Список pgsql-hackers
Hi,

On Tue, Nov 25, 2025 at 01:50:42PM +0800, Chao Li wrote:
> On Tue, Nov 25, 2025 at 11:03 AM Chao Li <li.evan.chao@gmail.com> wrote:
> 
> > Hi Hackers,
> >
> > While reviewing Jeff's patch [1], I found this bug in strlower_libc_sb():
> >
> > ```
> > static size_t
> > strlower_libc_sb(char *dest, size_t destsize, const char *src, ssize_t
> > srclen,
> > pg_locale_t locale)
> > {
> > if (srclen < 0)
> > srclen = strlen(src);

Nice catch!

FWIW this thread gave me the idea to create a coccinelle script to detect dead
branches [1]. It reports 4 more that are false positives, so I don't think there
is more dead branches in the code tree.

[1]: https://github.com/bdrouvot/coccinelle_on_pg/blob/main/misc/dead_branches.cocci

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



В списке pgsql-hackers по дате отправления: