Avoid fetching past the end of the indoption array.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 7 Apr 2019 22:18:58 +0000 (18:18 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 7 Apr 2019 22:19:16 +0000 (18:19 -0400)
commit80a96e066eecb6bd1788964b5911a405d932a784
treeec025af2953d528eb5901e3989bd9359b7c59074
parent1c5d9270e339662cdd78d51d0b859d4f0a11aa91
Avoid fetching past the end of the indoption array.

pg_get_indexdef_worker carelessly fetched indoption entries even for
non-key index columns that don't have one.  99.999% of the time this
would be harmless, since the code wouldn't examine the value ... but
some fine day this will be a fetch off the end of memory, resulting
in SIGSEGV.

Detected through valgrind testing.  Odd that the buildfarm's valgrind
critters haven't noticed.
src/backend/utils/adt/ruleutils.c