pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix array size allocation for HashAggregate hash keys. 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix array size allocation for HashAggregate hash keys. @ 2019-05-23 14:49 Andrew Gierth <rhodiumtoad@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Andrew Gierth @ 2019-05-23 14:49 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix array size allocation for HashAggregate hash keys. When there were duplicate columns in the hash key list, the array sizes could be miscomputed, resulting in access off the end of the array. Adjust the computation to ensure the array is always large enough. (I considered whether the duplicates could be removed in planning, but I can't rule out the possibility that duplicate columns might have different hash functions assigned. Simpler to just make sure it works at execution time regardless.) Bug apparently introduced in fc4b3dea2 as part of narrowing down the tuples stored in the hashtable. Reported by Colm McHugh of Salesforce, though I didn't use their patch. Backpatch back to version 10 where the bug was introduced. Discussion: https://postgr.es/m/CAFeeJoKKu0u+A_A9R9316djW-YW3-+Gtgvy3ju655qRHR3jtdA@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/44e95b5728a4569c494fa4ea4317f8a2f50a206b Modified Files -------------- src/backend/executor/nodeAgg.c | 29 ++++++++++++++++++++++------- src/test/regress/expected/aggregates.out | 18 ++++++++++++++++++ src/test/regress/sql/aggregates.sql | 7 +++++++ 3 files changed, 47 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix array size allocation for HashAggregate hash keys. @ 2019-05-23 14:49 Andrew Gierth <rhodiumtoad@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Andrew Gierth @ 2019-05-23 14:49 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix array size allocation for HashAggregate hash keys. When there were duplicate columns in the hash key list, the array sizes could be miscomputed, resulting in access off the end of the array. Adjust the computation to ensure the array is always large enough. (I considered whether the duplicates could be removed in planning, but I can't rule out the possibility that duplicate columns might have different hash functions assigned. Simpler to just make sure it works at execution time regardless.) Bug apparently introduced in fc4b3dea2 as part of narrowing down the tuples stored in the hashtable. Reported by Colm McHugh of Salesforce, though I didn't use their patch. Backpatch back to version 10 where the bug was introduced. Discussion: https://postgr.es/m/CAFeeJoKKu0u+A_A9R9316djW-YW3-+Gtgvy3ju655qRHR3jtdA@mail.gmail.com Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f7da492dca2a929045414aaf17f2e8cbf778df3d Modified Files -------------- src/backend/executor/nodeAgg.c | 29 ++++++++++++++++++++++------- src/test/regress/expected/aggregates.out | 18 ++++++++++++++++++ src/test/regress/sql/aggregates.sql | 7 +++++++ 3 files changed, 47 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix array size allocation for HashAggregate hash keys. @ 2019-05-23 14:49 Andrew Gierth <rhodiumtoad@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Andrew Gierth @ 2019-05-23 14:49 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix array size allocation for HashAggregate hash keys. When there were duplicate columns in the hash key list, the array sizes could be miscomputed, resulting in access off the end of the array. Adjust the computation to ensure the array is always large enough. (I considered whether the duplicates could be removed in planning, but I can't rule out the possibility that duplicate columns might have different hash functions assigned. Simpler to just make sure it works at execution time regardless.) Bug apparently introduced in fc4b3dea2 as part of narrowing down the tuples stored in the hashtable. Reported by Colm McHugh of Salesforce, though I didn't use their patch. Backpatch back to version 10 where the bug was introduced. Discussion: https://postgr.es/m/CAFeeJoKKu0u+A_A9R9316djW-YW3-+Gtgvy3ju655qRHR3jtdA@mail.gmail.com Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/99efd8d727b0662e152daa2ccd1dcc668ac36056 Modified Files -------------- src/backend/executor/nodeAgg.c | 29 ++++++++++++++++++++++------- src/test/regress/expected/aggregates.out | 18 ++++++++++++++++++ src/test/regress/sql/aggregates.sql | 7 +++++++ 3 files changed, 47 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2019-05-23 14:49 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-05-23 14:49 pgsql: Fix array size allocation for HashAggregate hash keys. Andrew Gierth <rhodiumtoad@postgresql.org> 2019-05-23 14:49 pgsql: Fix array size allocation for HashAggregate hash keys. Andrew Gierth <rhodiumtoad@postgresql.org> 2019-05-23 14:49 pgsql: Fix array size allocation for HashAggregate hash keys. Andrew Gierth <rhodiumtoad@postgresql.org>
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