Re: Incorrect assert in libpqwalreceiver

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Jacob Brazeal <jacob(dot)brazeal(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Incorrect assert in libpqwalreceiver
Date: 2025-03-09 18:46:15
Message-ID: 7a292c55-854a-4de8-8e94-d259bbb89299@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/03/2025 10:09, Jacob Brazeal wrote:
> The libpqrcv_connect function asserts 'Assert(i < sizeof(keys))', where
> keys is declared as const char *keys[6];.
>
> However, sizeof(keys) is not the correct way to check the array length
> (on my system, for example, it's 48 = 6 * 8 at this callsite, not 6.)
>
> I attached a patch to fix the assert, but I suppose we could also just
> remove the assert altogether, since it hasn't been doing anything for at
> least 8 years.

Committed, thanks!

I think it's still valuable; it's an easy mistake to make, to add a
parameter and forget to increase the array size.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Ford 2025-03-09 20:07:33 Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options
Previous Message Masahiko Sawada 2025-03-09 18:45:33 maintenance_work_mem = 64kB doesn't work for vacuum