Re: BUG #16189: The usage of NULL pointer in indexpath.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: starbugs(at)qq(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16189: The usage of NULL pointer in indexpath.c
Date: 2020-01-06 04:11:27
Message-ID: 885.1578283887@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> We checked the code in file “indexpath.c” and there are five errors
> occurring in lines 2799, 2881, 2882, 2883 and 2884. These five errors are
> all caused by the usage of pointers with NULL values. The code in line 2799
> is “leftop = (Node *) linitial(saop->args);” The pointer “soap” mentioned in
> this line is defined by the code in line 2786 as “ScalarArrayOpExpr *saop =
> (ScalarArrayOpExpr *) rinfo->clause;”, so it is assigned as the “clause”
> field of the input pointer “rinfo” of function
> “match_saopclause_to_indexcol”. For the rest four errors, the codes are
> “leftop = (Node *) linitial(clause->largs);”, “rightop = (Node *)
> linitial(clause->rargs);”, “expr_op = linitial_oid(clause->opnos);”, and
> “expr_coll = linitial_oid(clause->inputcollids);” respectively. The pointer
> “clause” mentioned in these four lines is defined by the code in line 2853
> as “RowCompareExpr *clause = (RowCompareExpr *) rinfo->clause;”, so it is
> assigned as the “clause” field of the input pointer “rinfo” of function
> “match_rowcompare_to_indexcol”.

And? You haven't given any reason to think that any of that is a problem.

It is true that this code is expecting that these lists aren't empty,
but that's checked upstream of here.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2020-01-06 05:18:00 Re: BUG #16190: The usage of NULL pointer in refint.c
Previous Message Tom Lane 2020-01-06 04:09:01 Re: BUG #16188: The usage of NULL pointer in rege_dfa.c