Re: Avoid possible dereference null pointer (contrib/postgres_fdw/postgres_fdw.c)
| От | Fujii Masao |
|---|---|
| Тема | Re: Avoid possible dereference null pointer (contrib/postgres_fdw/postgres_fdw.c) |
| Дата | |
| Msg-id | 2456c0bf-49a0-4792-9c7e-eee6b8bc339c@oss.nttdata.com обсуждение |
| Ответы |
Re: Avoid possible dereference null pointer (contrib/postgres_fdw/postgres_fdw.c)
|
| Список | pgsql-hackers |
On 2025/06/17 4:48, Ranier Vilela wrote:
> Hi.
>
> In the function *estimate_path_cost_size* the parameter
> fpextra can be NULL.
Yes.
> It is necessary to always check its validity,
> as is already done in other parts of the source.
>
> patch attached.
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.
Regards,
--
Fujii Masao
NTT DATA Japan Corporation
В списке pgsql-hackers по дате отправления: