| From: | Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Subject: | Backup manifests accept out-of-range LSNs |
| Date: | 2026-08-05 05:23:58 |
| Message-ID: | CAJTYsWXieRHb-ooV2XfjHAtBsS7+P5La_-o8-Cqi15CNDhh9hQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
355814931141 tightened the integer fields of a backup manifest, but
parse_xlogrecptr() in the same file still does:
if (sscanf(input, "%X/%08X", &hi, &lo) != 2)
"%X" stores into a uint32, so an oversized half is accepted with its
high bits dropped, and trailing text is ignored, since sscanf() still
returns 2. "123456789/0" is read as 23456789/0 and "1/2garbage" as
1/2, while "oops" is rejected as before.
That value validates the WAL ranges of a backup, in pg_verifybackup,
pg_combinebackup and the server's incremental backup path, so those
checks end up using a location the manifest doesn't contain.
The attached requires one to eight hex digits per half and the whole
string consumed, matching pg_lsn_in_safe(), and adds a few cases to
005_bad_manifest.pl. I stayed away from the strtoul()/endptr idiom the
neighbouring parsers use, since strtoul("-1", ..., 16) returns
ULONG_MAX without setting ERANGE, so "-1/0" would slip through as
FFFFFFFF/0.
Thoughts?
Regards,
Ayush
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Reject-out-of-range-LSNs-in-backup-manifests.patch | application/octet-stream | 3.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zhijie Hou (Fujitsu) | 2026-08-05 05:25:04 | RE: [bug fix] prepared transaction might be lost when max_prepared_transactions is zero on the subscriber |
| Previous Message | David Rowley | 2026-08-05 05:23:30 | Re: Reduce memory overheads for storing a Memoize tuple |