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

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)
Date: 2025-02-05 16:55:06
Message-ID: CAEudQApBsYrMOb8nNNT8a=j8BYkFKXCK11ycbN0KVFe7Jjy05Q@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 13:51, Ilia Evdokimov <
ilya(dot)evdokimov(at)tantorlabs(dot)com> escreveu:

>
> On 05.01.2025 02:29, Ranier Vilela 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.
> >
> > best regards,
> > Ranier Vilela
>
>
> Hi!
>
> Thanks for noticing this. If this happens in the planner, it poses a
> serious risk of a segmentation fault that could crash the instance if a
> NULL pointer is dereferenced. Since checking for NULL is very cheap, I
> support this patch.
>
Thanks for taking a look.

best regards,
Ranier Vilela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-02-05 17:07:50 Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)
Previous Message Ilia Evdokimov 2025-02-05 16:51:32 Re: Avoid possible deference NULL pointer (src/backend/optimizer/path/allpaths.c)