Re: Avoid possible dereference null pointer (contrib/postgres_fdw/postgres_fdw.c)
Etsuro Fujita <etsuro.fujita@gmail.com>
From: Etsuro Fujita <etsuro.fujita@gmail.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Ranier Vilela <ranier.vf@gmail.com>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2025-06-17T09:08:50Z
Lists: pgsql-hackers
Hi, On Tue, Jun 17, 2025 at 2:38 PM Fujii Masao <masao.fujii@oss.nttdata.com> wrote: > adjust_foreign_grouping_path_cost(root, pathkeys, > retrieved_rows, width, > - fpextra->limit_tuples, > + fpextra ? fpextra->limit_tuples : 0.0, > &disabled_nodes, > &startup_cost, &run_cost); > > I couldn't find a query that would reach this code path with > fpextra == NULL, but I agree the current code is fragile. > So I think it's a good idea to add the check before accessing > the field. We get here only when called from add_foreign_ordered_paths() or add_foreign_final_paths(), in which cases fpextra is always set, so it cannot be NULL. No? Best regards, Etsuro Fujita
Commits
-
postgres_fdw: Add Assert to estimate_path_cost_size().
- 21c9756db645 19 (unreleased) landed