Skip to content

Commit e3f40d8

Browse files
committed
Limit history size with MaxAllocSize / sizeof(HistoryItem)
If we allow history size of INT_MAX we can get easily get invalid memory alloc request size
1 parent 24cbdfa commit e3f40d8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pg_wait_sampling.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ _PG_init(void)
376376
&pgws_historySize,
377377
5000,
378378
100,
379-
INT_MAX,
379+
/* to avoid error in collector.c:alloc_history */
380+
MaxAllocSize / sizeof(HistoryItem),
380381
PGC_SIGHUP,
381382
0,
382383
NULL,

0 commit comments

Comments
 (0)