| From: | Kenny Chen <kennychen851228(at)gmail(dot)com> |
|---|---|
| To: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(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 11:51:32 |
| Message-ID: | CAPXstDtDEB_0N8-BeVcSnVJQiZ4Hiqmhz4srTZ6SpORd4AR5dg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi Hayato,
Thanks for looking at this.
> 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].
Agreed. IDENTIFY_SYSTEM tolerates 3 columns only because older servers (9.3
and earlier) actually returned 3, whereas CREATE_REPLICATION_SLOT has always
returned 4, so there is no reason to be lenient here. v2 attached requires 4
fields, and updates the comment and errdetail accordingly.
Best regards,
Kenny Chen
Hayato Kuroda (Fujitsu) <kuroda(dot)hayato(at)fujitsu(dot)com> 於 2026年7月15日週三 下午12:33寫道:
>
> 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
>
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Avoid-crash-on-malformed-CREATE_REPLICATION_SLOT-.patch | application/octet-stream | 2.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Maaz Syed Adeeb | 2026-07-15 13:05:06 | CREATE INDEX with an expression in an INCLUDE column fails with XX000 "unrecognized node type" instead of 0A000 on master |
| Previous Message | Hayato Kuroda (Fujitsu) | 2026-07-15 04:33:38 | RE: BUG #19547: libpqrcv_create_slot dereferences NULL on a malformed CREATE_REPLICATION_SLOT reply |