Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)
Date: 2025-02-05 17:34:57
Message-ID: CAEudQAoOZkWaWsaG29bP-wSe5eC+tUwySJgBzKPx=5fBa4gVxA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

Em qua., 5 de fev. de 2025 às 14:08, Daniel Gustafsson <daniel(at)yesql(dot)se>
escreveu:

> > On 5 Jan 2025, at 00:29, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> >
> > Hi.
> >
> > Per Coverity.
> >
> > All call sites of function *get_cheapest_path_for_pathkeys* checks
> > for NULL returns.
> >
> > So, it is highly likely that the function will return NULL.
> >
> > IMO, the Assert in this particular call, is not fully effective.
> >
> > Fix removing the Assert and always check if the return is NULL.
>
> Yet the author wrote an Assert here (over a decade ago), so rather than
> blindly
> changing that it seems reasonable to motivate a patch like this with an
> investigation on what the Assert means here. The fact that Coverity
> complains
> is far from conclusive evidence that something is wrong.
>
This is evidence that we do not have reports about this bug.
In any case, I think it's very unsafe for the future to trust that a
function that returns NULL
will never return in this particular case, don't you think?

best regards,
Ranier Vilela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-02-05 17:37:12 Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)
Previous Message Bertrand Drouvot 2025-02-05 17:32:01 Re: Failed assertion with jit enabled