Re: Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)
Date: 2024-05-24 11:48:32
Message-ID: CAExHW5vvX-D1srDzCpATc-L1DdsvJfYr6+K0eqsjNq7C5nbKKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 24, 2024 at 12:16 PM Michael Paquier <michael(at)paquier(dot)xyz>
wrote:

> On Fri, May 24, 2024 at 11:58:51AM +0530, Ashutosh Bapat wrote:
> > If we are looking for avoiding a segfault and get a message which helps
> > debugging, using get_attname and get_attnum might be better options.
> > get_attname throws an error. get_attnum doesn't throw an error and
> returns
> > InvalidAttnum which won't return any valid identity sequence, and thus
> > return a NIL sequence list which is handled in that function already.
> Using
> > these two functions will avoid the clutter as well as segfault. If that's
> > acceptable, I will provide a patch.
>
> Yeah, you could do that with these two routines as well. The result
> would be the same in terms of runtime validity checks.
>

PFA patch using those two routines.

--
Best Wishes,
Ashutosh Bapat

Attachment Content-Type Size
0001-Fix-potential-NULL-pointer-dereference-in-g-20240524.patch text/x-patch 2.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2024-05-24 12:05:35 Re: Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)
Previous Message Dmitry Dolgov 2024-05-24 11:31:43 Re: Schema variables - new implementation for Postgres 15