Skip to content

Commit fe838e5

Browse files
committed
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.
1 parent e9ad86c commit fe838e5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

contrib/auth_delay/auth_delay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ _PG_init(void)
5959
NULL,
6060
&auth_delay_milliseconds,
6161
0,
62-
0, INT_MAX,
62+
0, INT_MAX / 1000,
6363
PGC_SIGHUP,
6464
GUC_UNIT_MS,
6565
NULL,

src/backend/utils/misc/guc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,7 @@ static struct config_int ConfigureNamesInt[] =
14491449
GUC_UNIT_S
14501450
},
14511451
&XLogArchiveTimeout,
1452-
0, 0, INT_MAX,
1452+
0, 0, INT_MAX / 2,
14531453
NULL, NULL, NULL
14541454
},
14551455
{
@@ -1459,7 +1459,7 @@ static struct config_int ConfigureNamesInt[] =
14591459
GUC_NOT_IN_SAMPLE | GUC_UNIT_S
14601460
},
14611461
&PostAuthDelay,
1462-
0, 0, INT_MAX,
1462+
0, 0, INT_MAX / 1000000,
14631463
NULL, NULL, NULL
14641464
},
14651465
{

0 commit comments

Comments
 (0)