Skip to content

Commit 4317e38

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 f58f513 commit 4317e38

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
@@ -379,7 +379,8 @@ _PG_init(void)
379379
&pgws_historySize,
380380
5000,
381381
100,
382-
INT_MAX,
382+
/* to avoid error in collector.c:alloc_history */
383+
MaxAllocSize / sizeof(HistoryItem),
383384
PGC_SIGHUP,
384385
0,
385386
NULL,

0 commit comments

Comments
 (0)