pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: pg_basebackup: Fix crashes on malformed server responses 6+ messages / 1 participants [nested] [flat]
* pgsql: pg_basebackup: Fix crashes on malformed server responses @ 2026-11-21 14:22 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-11-21 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pg_basebackup: Fix crashes on malformed server responses pg_basebackup could crash when a server returned replication command results with missing rows or columns. This happened because pg_basebackup checked the row counts of the BASE_BACKUP results but not the column counts before reading the backup start and end positions and tablespace information. Its WAL streaming code checked the row and column counts of TIMELINE_HISTORY results, but only logged a warning on a mismatch and continued processing. These omissions allowed NULL pointers returned by PQgetvalue() for missing fields to reach string and numeric conversion functions. Fix this by requiring at least one column in the backup start and end results and at least three columns in the tablespace header before accessing their values. Also report an error, release the result, and stop the current WAL streaming attempt if a TIMELINE_HISTORY response does not contain exactly one row and two columns. The latter change also fixes the same crash in pg_receivewal, which shares this WAL streaming code. Backpatch to all supported versions. Author: s1ko <s1ko@riseup.net> Author: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/f1743511-5fab-482e-94ec-1198ce18723e@riseup.net Backpatch-through: 15 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d9c7185ee4613e245492ccda6942fcde263e0a11 Modified Files -------------- src/bin/pg_basebackup/pg_basebackup.c | 16 +++++++++------- src/bin/pg_basebackup/receivelog.c | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: pg_basebackup: Fix crashes on malformed server responses @ 2026-11-21 14:22 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-11-21 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pg_basebackup: Fix crashes on malformed server responses pg_basebackup could crash when a server returned replication command results with missing rows or columns. This happened because pg_basebackup checked the row counts of the BASE_BACKUP results but not the column counts before reading the backup start and end positions and tablespace information. Its WAL streaming code checked the row and column counts of TIMELINE_HISTORY results, but only logged a warning on a mismatch and continued processing. These omissions allowed NULL pointers returned by PQgetvalue() for missing fields to reach string and numeric conversion functions. Fix this by requiring at least one column in the backup start and end results and at least three columns in the tablespace header before accessing their values. Also report an error, release the result, and stop the current WAL streaming attempt if a TIMELINE_HISTORY response does not contain exactly one row and two columns. The latter change also fixes the same crash in pg_receivewal, which shares this WAL streaming code. Backpatch to all supported versions. Author: s1ko <s1ko@riseup.net> Author: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/f1743511-5fab-482e-94ec-1198ce18723e@riseup.net Backpatch-through: 15 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/892cfb4cbfe0e37cc492f0e750e80cfa6394d26d Modified Files -------------- src/bin/pg_basebackup/pg_basebackup.c | 16 +++++++++------- src/bin/pg_basebackup/receivelog.c | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: pg_basebackup: Fix crashes on malformed server responses @ 2026-11-21 14:22 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-11-21 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pg_basebackup: Fix crashes on malformed server responses pg_basebackup could crash when a server returned replication command results with missing rows or columns. This happened because pg_basebackup checked the row counts of the BASE_BACKUP results but not the column counts before reading the backup start and end positions and tablespace information. Its WAL streaming code checked the row and column counts of TIMELINE_HISTORY results, but only logged a warning on a mismatch and continued processing. These omissions allowed NULL pointers returned by PQgetvalue() for missing fields to reach string and numeric conversion functions. Fix this by requiring at least one column in the backup start and end results and at least three columns in the tablespace header before accessing their values. Also report an error, release the result, and stop the current WAL streaming attempt if a TIMELINE_HISTORY response does not contain exactly one row and two columns. The latter change also fixes the same crash in pg_receivewal, which shares this WAL streaming code. Backpatch to all supported versions. Author: s1ko <s1ko@riseup.net> Author: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/f1743511-5fab-482e-94ec-1198ce18723e@riseup.net Backpatch-through: 15 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0155c32fafd1e390e6d4ccf8b091287b16c7e12e Modified Files -------------- src/bin/pg_basebackup/pg_basebackup.c | 16 +++++++++------- src/bin/pg_basebackup/receivelog.c | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: pg_basebackup: Fix crashes on malformed server responses @ 2026-11-21 14:22 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-11-21 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pg_basebackup: Fix crashes on malformed server responses pg_basebackup could crash when a server returned replication command results with missing rows or columns. This happened because pg_basebackup checked the row counts of the BASE_BACKUP results but not the column counts before reading the backup start and end positions and tablespace information. Its WAL streaming code checked the row and column counts of TIMELINE_HISTORY results, but only logged a warning on a mismatch and continued processing. These omissions allowed NULL pointers returned by PQgetvalue() for missing fields to reach string and numeric conversion functions. Fix this by requiring at least one column in the backup start and end results and at least three columns in the tablespace header before accessing their values. Also report an error, release the result, and stop the current WAL streaming attempt if a TIMELINE_HISTORY response does not contain exactly one row and two columns. The latter change also fixes the same crash in pg_receivewal, which shares this WAL streaming code. Backpatch to all supported versions. Author: s1ko <s1ko@riseup.net> Author: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/f1743511-5fab-482e-94ec-1198ce18723e@riseup.net Backpatch-through: 15 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4fe8b64dc69844d20e2952a1343097c83d6e0b1c Modified Files -------------- src/bin/pg_basebackup/pg_basebackup.c | 16 +++++++++------- src/bin/pg_basebackup/receivelog.c | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: pg_basebackup: Fix crashes on malformed server responses @ 2026-11-21 14:22 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-11-21 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pg_basebackup: Fix crashes on malformed server responses pg_basebackup could crash when a server returned replication command results with missing rows or columns. This happened because pg_basebackup checked the row counts of the BASE_BACKUP results but not the column counts before reading the backup start and end positions and tablespace information. Its WAL streaming code checked the row and column counts of TIMELINE_HISTORY results, but only logged a warning on a mismatch and continued processing. These omissions allowed NULL pointers returned by PQgetvalue() for missing fields to reach string and numeric conversion functions. Fix this by requiring at least one column in the backup start and end results and at least three columns in the tablespace header before accessing their values. Also report an error, release the result, and stop the current WAL streaming attempt if a TIMELINE_HISTORY response does not contain exactly one row and two columns. The latter change also fixes the same crash in pg_receivewal, which shares this WAL streaming code. Backpatch to all supported versions. Author: s1ko <s1ko@riseup.net> Author: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/f1743511-5fab-482e-94ec-1198ce18723e@riseup.net Backpatch-through: 15 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/04137cd764c84a6a9b97384ae6566c4a25eaa828 Modified Files -------------- src/bin/pg_basebackup/pg_basebackup.c | 16 +++++++++------- src/bin/pg_basebackup/receivelog.c | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: pg_basebackup: Fix crashes on malformed server responses @ 2026-11-21 14:22 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Fujii Masao @ 2026-11-21 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pg_basebackup: Fix crashes on malformed server responses pg_basebackup could crash when a server returned replication command results with missing rows or columns. This happened because pg_basebackup checked the row counts of the BASE_BACKUP results but not the column counts before reading the backup start and end positions and tablespace information. Its WAL streaming code checked the row and column counts of TIMELINE_HISTORY results, but only logged a warning on a mismatch and continued processing. These omissions allowed NULL pointers returned by PQgetvalue() for missing fields to reach string and numeric conversion functions. Fix this by requiring at least one column in the backup start and end results and at least three columns in the tablespace header before accessing their values. Also report an error, release the result, and stop the current WAL streaming attempt if a TIMELINE_HISTORY response does not contain exactly one row and two columns. The latter change also fixes the same crash in pg_receivewal, which shares this WAL streaming code. Backpatch to all supported versions. Author: s1ko <s1ko@riseup.net> Author: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/f1743511-5fab-482e-94ec-1198ce18723e@riseup.net Backpatch-through: 15 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0c539dcd64045570e857aeb427fbe152a59b7502 Modified Files -------------- src/bin/pg_basebackup/pg_basebackup.c | 16 +++++++++------- src/bin/pg_basebackup/receivelog.c | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2026-11-21 14:22 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-11-21 14:22 pgsql: pg_basebackup: Fix crashes on malformed server responses Fujii Masao <fujii@postgresql.org> 2026-11-21 14:22 pgsql: pg_basebackup: Fix crashes on malformed server responses Fujii Masao <fujii@postgresql.org> 2026-11-21 14:22 pgsql: pg_basebackup: Fix crashes on malformed server responses Fujii Masao <fujii@postgresql.org> 2026-11-21 14:22 pgsql: pg_basebackup: Fix crashes on malformed server responses Fujii Masao <fujii@postgresql.org> 2026-11-21 14:22 pgsql: pg_basebackup: Fix crashes on malformed server responses Fujii Masao <fujii@postgresql.org> 2026-11-21 14:22 pgsql: pg_basebackup: Fix crashes on malformed server responses Fujii Masao <fujii@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox