pgsql: Use pg_parse_lsn() for LSNs in backup manifests

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use pg_parse_lsn() for LSNs in backup manifests
Date: 2026-09-04 14:06:35
Message-ID: E1x2UYs-00000003ScM-2ZYz@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use pg_parse_lsn() for LSNs in backup manifests

A user-supplied or modified backup manifest could contain an invalid WAL
range LSN that was nevertheless accepted by the manifest parser. For
example, an LSN component wider than 32 bits could be silently truncated,
and trailing characters after an otherwise valid LSN could be ignored.

This could cause pg_verifybackup, pg_combinebackup, and incremental
backup validation to check WAL availability against a different location
from the one specified in the manifest. PostgreSQL-generated manifests
should not contain such values, but tools consuming manifests should
reject invalid input rather than reinterpret it.

Fix this by using the common pg_parse_lsn() helper to parse LSNs in
backup manifests. It requires the same syntax as the pg_lsn input
function.

Author: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Reviewed-by: Yuefei Shi <shiyuefei1004(at)gmail(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAJTYsWXieRHb-ooV2XfjHAtBsS7+P5La_-o8-Cqi15CNDhh9hQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2227afac0171550b0e213173cadcefd165434b23

Modified Files
--------------
src/bin/pg_verifybackup/t/005_bad_manifest.pl | 14 ++++++++++++++
src/common/parse_manifest.c | 21 +++------------------
2 files changed, 17 insertions(+), 18 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2026-09-04 14:49:08 pgsql: Convert FixedParallelState->last_xlog_end to an atomic variable.
Previous Message Daniel Gustafsson 2026-09-04 11:47:59 Re: pgsql: Fix compilation with OpenSSL 4