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

Ranier Vilela <ranier.vf@gmail.com>

From: Ranier Vilela <ranier.vf@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-10-31T14:49:07Z
Lists: pgsql-hackers

Attachments

Hi,

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.

regards,
Ranier Vilela

Commits

  1. Remove special checks for pg_rewrite.ev_qual and ev_action being NULL.