| From: | Fujii Masao <fujii(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Reject overlong LSN components in START_REPLICATION |
| Date: | 2026-10-22 07:46:53 |
| Message-ID: | E1xJnVl-00000000IcG-19rz@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Reject overlong LSN components in START_REPLICATION
The replication command scanner accepts arbitrarily long hexadecimal
LSN components, but converts them with sscanf("%X/%08X") into uint32
values. An overlong high component can overflow, while an overlong low
component is truncated to its first eight digits. This can cause
START_REPLICATION to use a different WAL location from the one requested.
Use pg_parse_lsn() to validate and convert the complete LSN token,
requiring one to eight hexadecimal digits per component, as for pg_lsn
input. This applies to both physical and logical replication.
Reported-by: ♂π≌26218 <1991230470(at)qq(dot)com>
Author: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Reviewed-by: Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com>
Reviewed-by: Jan Nidzwetzki <jan(at)planetscale(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/tencent_C6ED19DF1759CDD37E786F7EE0B5207D0009@qq.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/4a842a1d6570b0875fb705e6335a16b525cbbd79
Modified Files
--------------
src/backend/replication/repl_scanner.l | 6 ++----
src/test/recovery/t/006_logical_decoding.pl | 12 ++++++++++++
2 files changed, 14 insertions(+), 4 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-10-22 08:18:34 | pgsql: pg_stat_statements: Add tests for SQL/JSON query patterns |
| Previous Message | Michael Paquier | 2026-10-22 05:39:51 | pgsql: Fix argument handling in pg_indexam_progress_phasename() |