1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-26 12:21:12 +03:00

Avoid overflow in MaybeRemoveOldWalSummaries().

This commit limits the maximum value of wal_summary_keep_time to
INT_MAX / SECS_PER_MINUTE to avoid overflow when it is converted to
seconds.  In passing, use the HOURS_PER_DAY, MINS_PER_HOUR, and
SECS_PER_MINUTE macros in the code for this GUC instead of hard-
coding those values.

Discussion: https://postgr.es/m/20240314210010.GA3056455%40nathanxps13
This commit is contained in:
Nathan Bossart
2024-03-20 13:31:58 -05:00
parent 9acae56ce0
commit 80686761c4
2 changed files with 4 additions and 4 deletions

View File

@ -3293,9 +3293,9 @@ struct config_int ConfigureNamesInt[] =
GUC_UNIT_MIN,
},
&wal_summary_keep_time,
10 * 24 * 60, /* 10 days */
10 * HOURS_PER_DAY * MINS_PER_HOUR, /* 10 days */
0,
INT_MAX,
INT_MAX / SECS_PER_MINUTE,
NULL, NULL, NULL
},