agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver
7+ messages / 1 participants
[nested] [flat]

* pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver
@ 2026-07-16 04:41 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-07-16 04:41 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver

Previously, libpqrcv_create_slot() checked only that
CREATE_REPLICATION_SLOT returned PGRES_TUPLES_OK before reading
values from the first row. If the server unexpectedly returned an
invalid result, such as zero rows, PQgetvalue() could return NULL,
leading to a crash while parsing the LSN.

Other replication commands, such as IDENTIFY_SYSTEM, already validate
the response shape before accessing result values, but
CREATE_REPLICATION_SLOT did not.

Fix this by verifying that CREATE_REPLICATION_SLOT response contains
exactly one row with four fields, and report a protocol violation otherwise.

Backpatch to all supported versions.

Bug: #19547
Reported-by: Yuelin Wang <1217816127@qq.com>
Author: Kenny Chen <kennychen851228@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/19547-f7986f668f71e788@postgresql.org
Discussion: https://postgr.es/m/CAPXstDtW2iqe+DJAOTQTX+rRziJp2UhZSo1+HRj1COAtbu+nKw@mail.gmail.com
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3cf5264557bee2ba848e5276beecc10571d468a6

Modified Files
--------------
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver
@ 2026-07-16 04:41 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-07-16 04:41 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver

Previously, libpqrcv_create_slot() checked only that
CREATE_REPLICATION_SLOT returned PGRES_TUPLES_OK before reading
values from the first row. If the server unexpectedly returned an
invalid result, such as zero rows, PQgetvalue() could return NULL,
leading to a crash while parsing the LSN.

Other replication commands, such as IDENTIFY_SYSTEM, already validate
the response shape before accessing result values, but
CREATE_REPLICATION_SLOT did not.

Fix this by verifying that CREATE_REPLICATION_SLOT response contains
exactly one row with four fields, and report a protocol violation otherwise.

Backpatch to all supported versions.

Bug: #19547
Reported-by: Yuelin Wang <1217816127@qq.com>
Author: Kenny Chen <kennychen851228@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/19547-f7986f668f71e788@postgresql.org
Discussion: https://postgr.es/m/CAPXstDtW2iqe+DJAOTQTX+rRziJp2UhZSo1+HRj1COAtbu+nKw@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0231fa2c3a8621450e51044d335725dae2338abb

Modified Files
--------------
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver
@ 2026-07-16 04:42 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-07-16 04:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver

Previously, libpqrcv_create_slot() checked only that
CREATE_REPLICATION_SLOT returned PGRES_TUPLES_OK before reading
values from the first row. If the server unexpectedly returned an
invalid result, such as zero rows, PQgetvalue() could return NULL,
leading to a crash while parsing the LSN.

Other replication commands, such as IDENTIFY_SYSTEM, already validate
the response shape before accessing result values, but
CREATE_REPLICATION_SLOT did not.

Fix this by verifying that CREATE_REPLICATION_SLOT response contains
exactly one row with four fields, and report a protocol violation otherwise.

Backpatch to all supported versions.

Bug: #19547
Reported-by: Yuelin Wang <1217816127@qq.com>
Author: Kenny Chen <kennychen851228@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/19547-f7986f668f71e788@postgresql.org
Discussion: https://postgr.es/m/CAPXstDtW2iqe+DJAOTQTX+rRziJp2UhZSo1+HRj1COAtbu+nKw@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a6a2eb9f602490ca215371ba2497b07efccaace7

Modified Files
--------------
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver
@ 2026-07-16 04:42 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-07-16 04:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver

Previously, libpqrcv_create_slot() checked only that
CREATE_REPLICATION_SLOT returned PGRES_TUPLES_OK before reading
values from the first row. If the server unexpectedly returned an
invalid result, such as zero rows, PQgetvalue() could return NULL,
leading to a crash while parsing the LSN.

Other replication commands, such as IDENTIFY_SYSTEM, already validate
the response shape before accessing result values, but
CREATE_REPLICATION_SLOT did not.

Fix this by verifying that CREATE_REPLICATION_SLOT response contains
exactly one row with four fields, and report a protocol violation otherwise.

Backpatch to all supported versions.

Bug: #19547
Reported-by: Yuelin Wang <1217816127@qq.com>
Author: Kenny Chen <kennychen851228@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/19547-f7986f668f71e788@postgresql.org
Discussion: https://postgr.es/m/CAPXstDtW2iqe+DJAOTQTX+rRziJp2UhZSo1+HRj1COAtbu+nKw@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1423a6efd018b27352c24198270770bc5ca6cb97

Modified Files
--------------
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver
@ 2026-07-16 04:42 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-07-16 04:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver

Previously, libpqrcv_create_slot() checked only that
CREATE_REPLICATION_SLOT returned PGRES_TUPLES_OK before reading
values from the first row. If the server unexpectedly returned an
invalid result, such as zero rows, PQgetvalue() could return NULL,
leading to a crash while parsing the LSN.

Other replication commands, such as IDENTIFY_SYSTEM, already validate
the response shape before accessing result values, but
CREATE_REPLICATION_SLOT did not.

Fix this by verifying that CREATE_REPLICATION_SLOT response contains
exactly one row with four fields, and report a protocol violation otherwise.

Backpatch to all supported versions.

Bug: #19547
Reported-by: Yuelin Wang <1217816127@qq.com>
Author: Kenny Chen <kennychen851228@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/19547-f7986f668f71e788@postgresql.org
Discussion: https://postgr.es/m/CAPXstDtW2iqe+DJAOTQTX+rRziJp2UhZSo1+HRj1COAtbu+nKw@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d7bb9f643b374112cf806b40def8e3783493ebc2

Modified Files
--------------
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver
@ 2026-07-16 04:42 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-07-16 04:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver

Previously, libpqrcv_create_slot() checked only that
CREATE_REPLICATION_SLOT returned PGRES_TUPLES_OK before reading
values from the first row. If the server unexpectedly returned an
invalid result, such as zero rows, PQgetvalue() could return NULL,
leading to a crash while parsing the LSN.

Other replication commands, such as IDENTIFY_SYSTEM, already validate
the response shape before accessing result values, but
CREATE_REPLICATION_SLOT did not.

Fix this by verifying that CREATE_REPLICATION_SLOT response contains
exactly one row with four fields, and report a protocol violation otherwise.

Backpatch to all supported versions.

Bug: #19547
Reported-by: Yuelin Wang <1217816127@qq.com>
Author: Kenny Chen <kennychen851228@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/19547-f7986f668f71e788@postgresql.org
Discussion: https://postgr.es/m/CAPXstDtW2iqe+DJAOTQTX+rRziJp2UhZSo1+HRj1COAtbu+nKw@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0a03b598e64f810bfc2c46b0097860ed380a923e

Modified Files
--------------
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver
@ 2026-07-16 04:42 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-07-16 04:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver

Previously, libpqrcv_create_slot() checked only that
CREATE_REPLICATION_SLOT returned PGRES_TUPLES_OK before reading
values from the first row. If the server unexpectedly returned an
invalid result, such as zero rows, PQgetvalue() could return NULL,
leading to a crash while parsing the LSN.

Other replication commands, such as IDENTIFY_SYSTEM, already validate
the response shape before accessing result values, but
CREATE_REPLICATION_SLOT did not.

Fix this by verifying that CREATE_REPLICATION_SLOT response contains
exactly one row with four fields, and report a protocol violation otherwise.

Backpatch to all supported versions.

Bug: #19547
Reported-by: Yuelin Wang <1217816127@qq.com>
Author: Kenny Chen <kennychen851228@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/19547-f7986f668f71e788@postgresql.org
Discussion: https://postgr.es/m/CAPXstDtW2iqe+DJAOTQTX+rRziJp2UhZSo1+HRj1COAtbu+nKw@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2f4f193fdbe057029b87ae45822e22e7a8b85693

Modified Files
--------------
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 8 ++++++++
1 file changed, 8 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-07-16 04:42 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-07-16 04:41 pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver Fujii Masao <fujii@postgresql.org>
2026-07-16 04:41 pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver Fujii Masao <fujii@postgresql.org>
2026-07-16 04:42 pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver Fujii Masao <fujii@postgresql.org>
2026-07-16 04:42 pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver Fujii Masao <fujii@postgresql.org>
2026-07-16 04:42 pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver Fujii Masao <fujii@postgresql.org>
2026-07-16 04:42 pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver Fujii Masao <fujii@postgresql.org>
2026-07-16 04:42 pgsql: Check CREATE_REPLICATION_SLOT response shape in libpqwalreceiver Fujii Masao <fujii@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox