pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84:sanity check after use ?
2+ messages / 2 participants
[nested] [flat]

* postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84:sanity check after use ?
@ 2017-10-06 15:18 David Binderman <dcb314@hotmail.com>
  2017-10-06 16:40 ` Re: postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84:sanity check after use ? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: David Binderman @ 2017-10-06 15:18 UTC (permalink / raw)
  To: pgsql-bugs

Hello there,

postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84]: (style) Array index 'j' is used before limits check.

Source code is

     while ((city_table[j].select_list == -1) && (j < num_gene))

Suggest sanity check array index before use, not after.

Regards

David Binderman



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84:sanity check after use ?
  2017-10-06 15:18 postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84:sanity check after use ? David Binderman <dcb314@hotmail.com>
@ 2017-10-06 16:40 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2017-10-06 16:40 UTC (permalink / raw)
  To: David Binderman <dcb314@hotmail.com>; +Cc: pgsql-bugs

David Binderman <dcb314@hotmail.com> writes:
> postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84]: (style) Array index 'j' is used before limits check.

Hmm, this code is ifdef'd out as of v10, so I'm not sure why your
tool paid any attention to it.

Since it's not used, and hasn't been used in decades, and has got more
bugs than just this stylistic one (in particular, even if we fixed that
innermost loop, the next line would still access the undefined select_list
value; plus I think it will fail badly in the event that the "make a list
of selected cities" loop picks the same "pos" more than once),
I'm disinclined to spend any effort on fixing it.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-10-06 16:40 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-10-06 15:18 postgresql-10.0/src/backend/optimizer/geqo/geqo_ox2.c:84:sanity check after use ? David Binderman <dcb314@hotmail.com>
2017-10-06 16:40 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox