From: | Masahiko Sawada <msawada(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: pg_logicalinspect: Fix possible crash when passing a directory p |
Date: | 2025-03-11 16:57:06 |
Message-ID: | E1ts2ug-001xVQ-04@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
pg_logicalinspect: Fix possible crash when passing a directory path.
Previously, pg_logicalinspect functions were too trusting of their
input and blindly passed it to SnapBuildRestoreSnapshot(). If the
input pointed to a directory, the server could a PANIC error while
attempting to fsync_fname() with isdir=false on a directory.
This commit adds validation checks for input filenames and passes the
LSN extracted from the filename to SnapBuildRestoreSnapshot() instead
of the filename itself. It also adds regression tests for various
input patterns and permission checks.
Bug: #18828
Reported-by: Robins Tharakan <tharakan(at)gmail(dot)com>
Co-authored-by: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Co-authored-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Discussion: https://postgr.es/m/18828-0f4701c635064211@postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/bd65cb3cd48a7a5ce48b26f8031ad3968efed87e
Modified Files
--------------
contrib/pg_logicalinspect/Makefile | 1 +
.../expected/pg_logicalinspect.out | 81 ++++++++++++++++++++++
contrib/pg_logicalinspect/pg_logicalinspect.c | 55 ++++++++++++---
.../pg_logicalinspect/sql/pg_logicalinspect.sql | 48 +++++++++++++
src/backend/replication/logical/snapbuild.c | 14 ++--
src/include/replication/snapbuild_internal.h | 2 +-
6 files changed, 183 insertions(+), 18 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2025-03-11 21:29:21 | pgsql: Assert that a snapshot is active or registered before it's used |
Previous Message | Masahiko Sawada | 2025-03-11 16:30:14 | pgsql: pg_logicalinspect: Stabilize isolation tests. |