Re: BUG #19598: pg_waldump: -s/-e accept out-of-range WAL locations and silently use the low 32 bits

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Zexin Li <lizi(dot)openmind(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, malis(at)pgrust(dot)com
Subject: Re: BUG #19598: pg_waldump: -s/-e accept out-of-range WAL locations and silently use the low 32 bits
Date: 2026-08-10 05:47:39
Message-ID: CAHGQGwEACikthuAtwOM9kagkLfBqUNcTR6jiqrspSurjswyYow@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Aug 7, 2026 at 10:58 AM Zexin Li <lizi(dot)openmind(at)gmail(dot)com> wrote:
> The helper is pg_parse_lsn() in the new src/common/pg_parse_lsn.c,
> with the same rules as the backend's pg_lsn_in_safe(): one to eight
> hex digits, a slash, one to eight hex digits, and nothing else.
> pg_waldump's static helper from v1 moves there, and pg_recvlogical
> (-I/-E) and pg_receivewal (-E) now go through it as well.

> * The backend's pg_lsn_in_safe() is left untouched for now.

Thanks for updating the patch!

Attached is a revised version. It keeps the v2 approach of adding
pg_parse_lsn() in src/common and using it for user-supplied LSN
command-line options in pg_waldump, pg_recvlogical, and
pg_receivewal.

The main change from v2 is that pg_lsn_in_safe() now also uses
pg_parse_lsn(), leaving only the backend-specific soft-error handling
there. This avoids duplicating the LSN syntax checks.

Thought?

Regards,

--
Fujii Masao

Attachment Content-Type Size
v3-0001-Add-common-LSN-parser-for-user-supplied-locations.patch application/octet-stream 13.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ayush Tiwari 2026-08-10 08:23:21 Re: BUG #19598: pg_waldump: -s/-e accept out-of-range WAL locations and silently use the low 32 bits
Previous Message Michael Paquier 2026-08-09 23:42:06 Re: PostgreSQL 18.4 backend SIGSEGV in pgstat_gc_entry_refs() after caught DSM attach error