Re: Explicit NULL dereference (src/backend/utils/adt/ruleutils.c)

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: ranier(dot)vf(at)gmail(dot)com
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Explicit NULL dereference (src/backend/utils/adt/ruleutils.c)
Date: 2020-11-02 01:36:10
Message-ID: 20201102.103610.1084391008125193313.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Sat, 31 Oct 2020 11:49:07 -0300, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote in
> Per Coverity.
>
> make_ruledef function can dereference a NULL pointer (actions),
> if "ev_qual" is provided and "actions" does not exist.
>
> The comment there is contradictory: " /* these could be nulls */ "
> Because if "ev_qual" is not null, "actions" cannot be either.
>
> Solution proposed merely as a learning experience.

We cannot reach there with ev_action == NULL since it comes from a
non-nullable column. Since most of the other columns has an assertion
that !isnull, I think we should do the same thing for ev_action (and
ev_qual). SPI_getvalue() returns C-NULL for SQL-NULL (or for some
other unexpected situations.).

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
ev_qual_and_action_catnnot_be_null.patch text/x-patch 747 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2020-11-02 01:39:40 Re: Online checksums verification in the backend
Previous Message Michael Paquier 2020-11-02 01:05:25 Re: Online checksums verification in the backend