1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Further patch rangetypes_selfuncs.c's statistics slot management.

Values in a STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM slot are float8,
not of the type of the column the statistics are for.

This bug is at least partly the fault of sloppy specification comments
for get_attstatsslot()/free_attstatsslot(): the type OID they want is that
of the stavalues entries, not of the underlying column.  (I double-checked
other callers and they seem to get this right.)  Adjust the comments to be
more correct.

Per buildfarm.

Security: CVE-2017-7484
This commit is contained in:
Tom Lane
2017-05-08 15:02:57 -04:00
parent fe974cc5a6
commit da07596006
3 changed files with 14 additions and 11 deletions

View File

@ -2865,8 +2865,8 @@ get_attavgwidth(Oid relid, AttrNumber attnum)
* pg_statistic.
*
* statstuple: pg_statistic tuple to be examined.
* atttype: type OID of attribute (can be InvalidOid if values == NULL).
* atttypmod: typmod of attribute (can be 0 if values == NULL).
* atttype: type OID of slot's stavalues (can be InvalidOid if values == NULL).
* atttypmod: typmod of slot's stavalues (can be 0 if values == NULL).
* reqkind: STAKIND code for desired statistics slot kind.
* reqop: STAOP value wanted, or InvalidOid if don't care.
* actualop: if not NULL, *actualop receives the actual STAOP value.
@ -2874,7 +2874,7 @@ get_attavgwidth(Oid relid, AttrNumber attnum)
* numbers, nnumbers: if not NULL, the slot's stanumbers are extracted.
*
* If assigned, values and numbers are set to point to palloc'd arrays.
* If the attribute type is pass-by-reference, the values referenced by
* If the stavalues datatype is pass-by-reference, the values referenced by
* the values array are themselves palloc'd. The palloc'd stuff can be
* freed by calling free_attstatsslot.
*
@ -3004,7 +3004,8 @@ get_attstatsslot(HeapTuple statstuple,
* free_attstatsslot
* Free data allocated by get_attstatsslot
*
* atttype need be valid only if values != NULL.
* atttype is the type of the individual values in values[].
* It need be valid only if values != NULL.
*/
void
free_attstatsslot(Oid atttype,