Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita0b0136

Browse files
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: 12
1 parent6103d2c commita0b0136

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/backend/postmaster/pgstat.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3409,7 +3409,8 @@ pgstat_read_current_status(void)
34093409
NAMEDATALEN*NumBackendStatSlots);
34103410
localactivity= (char*)
34113411
MemoryContextAllocHuge(pgStatLocalContext,
3412-
pgstat_track_activity_query_size*NumBackendStatSlots);
3412+
(Size)pgstat_track_activity_query_size*
3413+
(Size)NumBackendStatSlots);
34133414
#ifdefUSE_SSL
34143415
localsslstatus= (PgBackendSSLStatus*)
34153416
MemoryContextAlloc(pgStatLocalContext,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp