pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: postgres_fdw: Fix possible crash after option initialization fai 2+ messages / 1 participants [nested] [flat]
* pgsql: postgres_fdw: Fix possible crash after option initialization fai @ 2026-11-12 00:25 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Fujii Masao @ 2026-11-12 00:25 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Fix possible crash after option initialization fails An out-of-memory error while initializing postgres_fdw's option array could cause a later operation using postgres_fdw in the same session to crash. InitPgFdwOptions() assigned postgres_fdw_options before filling the array. If MemoryContextStrdup() failed while copying an option name, the pointer remained non-NULL, causing subsequent calls to skip initialization and use the incomplete array. Fix this by building the array using a local pointer and assign postgres_fdw_options only after initialization is complete, so that a failed attempt can be retried safely. Backpatch to v19, where commit 0f9d4d7c12d introduced the MemoryContextStrdup() calls that made this failure possible. Author: Lucas Jeffrey <luquijeffrey@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/CAObkL7OzJWqNg170qM=+zQjw1-EyvKc8LjWizjcnw4fEjB5mnw@mail.gmail.com Backpatch-through: 19 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/1d4324a2a302514a24908435dede693cff81fa37 Modified Files -------------- contrib/postgres_fdw/option.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: postgres_fdw: Fix possible crash after option initialization fai @ 2026-11-12 00:25 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Fujii Masao @ 2026-11-12 00:25 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Fix possible crash after option initialization fails An out-of-memory error while initializing postgres_fdw's option array could cause a later operation using postgres_fdw in the same session to crash. InitPgFdwOptions() assigned postgres_fdw_options before filling the array. If MemoryContextStrdup() failed while copying an option name, the pointer remained non-NULL, causing subsequent calls to skip initialization and use the incomplete array. Fix this by building the array using a local pointer and assign postgres_fdw_options only after initialization is complete, so that a failed attempt can be retried safely. Backpatch to v19, where commit 0f9d4d7c12d introduced the MemoryContextStrdup() calls that made this failure possible. Author: Lucas Jeffrey <luquijeffrey@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/CAObkL7OzJWqNg170qM=+zQjw1-EyvKc8LjWizjcnw4fEjB5mnw@mail.gmail.com Backpatch-through: 19 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/346d89bd9cb0c943f4362ce369b6d8a32365d39a Modified Files -------------- contrib/postgres_fdw/option.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-11-12 00:25 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-11-12 00:25 pgsql: postgres_fdw: Fix possible crash after option initialization fai Fujii Masao <fujii@postgresql.org> 2026-11-12 00:25 pgsql: postgres_fdw: Fix possible crash after option initialization fai Fujii Masao <fujii@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox