RE: BUG #19547: libpqrcv_create_slot dereferences NULL on a malformed CREATE_REPLICATION_SLOT reply

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Kenny Chen' <kennychen851228(at)gmail(dot)com>
Cc: "1217816127(at)qq(dot)com" <1217816127(at)qq(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: RE: BUG #19547: libpqrcv_create_slot dereferences NULL on a malformed CREATE_REPLICATION_SLOT reply
Date: 2026-07-15 04:33:38
Message-ID: OS9PR01MB12149312CF887180E9565CC04F5F82@OS9PR01MB12149.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Kenny,

> The patch validates the result shape (>= 3 fields, exactly 1 row) before
> reading those fields and raises a protocol-violation error otherwise,
> mirroring what libpqrcv_identify_system() and the other result-consuming
> paths in this file already do. I used "< 3" rather than "< 4" because the
> function only reads fields 1 and 2.

Hmm, but IDENTIFY_SYSTEM requires that number returned attributes should be 3 or
4, nevertheless first and second columns are checked. If we follow, isn't it
better to require that there are 4 attributes? I checked old versions and the
command has returned 4 attributes from the beginning [1].

[1]: https://github.com/postgres/postgres/blob/b1b8b8e6f141e378db21c609d8ee74d9125a4aca/src/backend/replication/walsender.c#L853

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kenny Chen 2026-07-15 11:51:32 Re: BUG #19547: libpqrcv_create_slot dereferences NULL on a malformed CREATE_REPLICATION_SLOT reply
Previous Message Masahiko Sawada 2026-07-14 19:15:26 Re: uuidv7 improperly accepts dates before 1970-01-01