From fe838e5074149058a1101092d3a557e4b86b8ff2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 18 Nov 2012 17:15:16 -0500 Subject: [PATCH] Limit values of archive_timeout, post_auth_delay, auth_delay.milliseconds. The previous definitions of these GUC variables allowed them to range up to INT_MAX, but in point of fact the underlying code would suffer overflows or other errors with large values. Reduce the maximum values to something that won't misbehave. There's no apparent value in working harder than this, since very large delays aren't sensible for any of these. (Note: the risk with archive_timeout is that if we're late checking the state, the timestamp difference it's being compared to might overflow. So we need some amount of slop; the choice of INT_MAX/2 is arbitrary.) Per followup investigation of bug #7670. Although this isn't a very significant fix, might as well back-patch. --- contrib/auth_delay/auth_delay.c | 2 +- src/backend/utils/misc/guc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/auth_delay/auth_delay.c b/contrib/auth_delay/auth_delay.c index 4e0d5959d19..3131e827b82 100644 --- a/contrib/auth_delay/auth_delay.c +++ b/contrib/auth_delay/auth_delay.c @@ -59,7 +59,7 @@ _PG_init(void) NULL, &auth_delay_milliseconds, 0, - 0, INT_MAX, + 0, INT_MAX / 1000, PGC_SIGHUP, GUC_UNIT_MS, NULL, diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index e9b665095dc..a363441d8f7 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -1449,7 +1449,7 @@ static struct config_int ConfigureNamesInt[] = GUC_UNIT_S }, &XLogArchiveTimeout, - 0, 0, INT_MAX, + 0, 0, INT_MAX / 2, NULL, NULL, NULL }, { @@ -1459,7 +1459,7 @@ static struct config_int ConfigureNamesInt[] = GUC_NOT_IN_SAMPLE | GUC_UNIT_S }, &PostAuthDelay, - 0, 0, INT_MAX, + 0, 0, INT_MAX / 1000000, NULL, NULL, NULL }, { -- 2.39.5