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

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)
Date: 2024-05-22 16:09:50
Message-ID: CAEudQArPZ3dTzvzEZCfxxxjBo6Nz0i-LJX712Hb4yUXuNtUNEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qua., 22 de mai. de 2024 às 11:44, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
escreveu:

> Hi.
>
> Per Coverity.
>
> 2. returned_null: SearchSysCacheAttName returns NULL (checked 20 out of
> 21 times).
> 3. var_assigned: Assigning: ptup = NULL return value from
> SearchSysCacheAttName.
> 964 ptup = SearchSysCacheAttName(relid, attname);
> CID 1545986: (#1 of 1): Dereference null return value (NULL_RETURNS)
> 4. dereference: Dereferencing ptup, which is known to be NULL.
>
> The functions SearchSysCacheAttNum and SearchSysCacheAttName,
> need to have the result checked.
>
> The commit 5091995
> <https://github.com/postgres/postgres/commit/509199587df73f06eda898ae13284292f4ae573a>,
> left an oversight.
>
> Fixed by the patch attached, a change of style, unfortunately, was
> necessary.
>
v1 Attached, fix wrong column variable name in error report.

best regards,
Ranier Vilela

Attachment Content-Type Size
v1-fix-catalog-cache-seach-check.patch application/octet-stream 1.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sriram RK 2024-05-22 16:15:35 Re: AIX support
Previous Message Heikki Linnakangas 2024-05-22 15:29:34 Re: An implementation of multi-key sort