aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-05-08 15:02:57 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-05-08 15:03:14 -0400
commitda0759600664439238fe25fa84b1f0059bfdcdd6 (patch)
treea7a9e9c350e9459c9c613f825543937bb4a980df /src/backend/utils/cache
parentfe974cc5a69903e9f53b36d6e2709fd3de0a1ac7 (diff)
downloadpostgresql-da0759600664439238fe25fa84b1f0059bfdcdd6.tar.gz
postgresql-da0759600664439238fe25fa84b1f0059bfdcdd6.zip
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
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r--src/backend/utils/cache/lsyscache.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 0667ef5a81b..236d876b1c6 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -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,