aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeMemoize.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2023-10-03 15:37:19 +0900
committerMichael Paquier <michael@paquier.xyz>2023-10-03 15:37:19 +0900
commit95e91da66cf5bbaf46c34c9386c93004f28d6719 (patch)
tree2bdb4ada34ca31ab771b4e018827622729f1d9c7 /src/backend/executor/nodeMemoize.c
parentafc79591de8e2facc3e22f8746ee2b7e59a2a741 (diff)
downloadpostgresql-95e91da66cf5bbaf46c34c9386c93004f28d6719.tar.gz
postgresql-95e91da66cf5bbaf46c34c9386c93004f28d6719.zip
Avoid memory size overflow when allocating backend activity buffer
The code in charge of copying the contents of PgBackendStatus to local memory could fail on memory allocation because of an overflow on the amount of memory to use. The overflow can happen when combining a high value track_activity_query_size (max at 1MB) with a large max_connections, when both multiplied get higher than INT32_MAX as both parameters treated as signed integers. This could for example trigger with the following functions, all calling pgstat_read_current_status(): - pg_stat_get_backend_subxact() - pg_stat_get_backend_idset() - pg_stat_get_progress_info() - pg_stat_get_activity() - pg_stat_get_db_numbackends() The change to use MemoryContextAllocHuge() has been introduced in 8d0ddccec636, so backpatch down to 12. Author: Jakub Wartak Discussion: https://postgr.es/m/CAKZiRmw8QSNVw2qNK-dznsatQqz+9DkCquxP0GHbbv1jMkGHMA@mail.gmail.com Backpatch-through: 12
Diffstat (limited to 'src/backend/executor/nodeMemoize.c')
0 files changed, 0 insertions, 0 deletions