Use pg_parse_lsn() to parse LSN fields in backup_label

The START WAL LOCATION and CHECKPOINT LOCATION fields in backup_label
accepted overlong high components, which could overflow and produce a
different LSN from the one supplied.

Use pg_parse_lsn() to validate and convert these fields, requiring one
to eight hexadecimal digits per component and no trailing characters,
as for pg_lsn input.

Also detect INCREMENTAL FROM LSN without parsing its value, so that
malformed values such as "junk" do not bypass the existing check
against using an incremental backup directly as a data directory.

Author: Hayato Kuroda <[email protected]>
Reviewed-by: Jan Nidzwetzki <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: 
https://postgr.es/m/os7pr01mb18317eed85b1a72c69b226630f5...@os7pr01mb18317.jpnprd01.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/76a55702d89ba9f5d0198c2d5d3d2d62357a8880

Modified Files
--------------
src/backend/access/transam/xlogrecovery.c | 27 ++++++++++++++++++---------
src/backend/utils/adt/pg_lsn.c            |  2 --
src/include/common/pg_parse_lsn.h         |  2 ++
3 files changed, 20 insertions(+), 11 deletions(-)

Reply via email to