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 <[email protected]>
Reviewed-by: Yuefei Shi <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: 
https://postgr.es/m/cajtyswxierhb-oov2xfjhatbss7+p5la_-o8-cqi15cndhh...@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(-)

Reply via email to