forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita956bd3
committed
Avoid memory size overflow when allocating backend activity buffer
The code in charge of copying the contents of PgBackendStatus to localmemory could fail on memory allocation because of an overflow on theamount of memory to use. The overflow can happen when combining a highvalue track_activity_query_size (max at 1MB) with a largemax_connections, when both multiplied get higher than INT32_MAX as bothparameters treated as signed integers. This could for example triggerwith 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 in8d0ddcc, so backpatch down to 12.Author: Jakub WartakDiscussion:https://postgr.es/m/CAKZiRmw8QSNVw2qNK-dznsatQqz+9DkCquxP0GHbbv1jMkGHMA@mail.gmail.comBackpatch-through: 121 parentaea599c commita956bd3
1 file changed
+2
-1
lines changedLines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
765 | 765 |
| |
766 | 766 |
| |
767 | 767 |
| |
768 |
| - | |
| 768 | + | |
| 769 | + | |
769 | 770 |
| |
770 | 771 |
| |
771 | 772 |
| |
|
0 commit comments
Comments
(0)