]> granicus.if.org Git - postgresql/commitdiff
Limit values of archive_timeout, post_auth_delay, auth_delay.milliseconds.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 18 Nov 2012 22:15:11 +0000 (17:15 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 18 Nov 2012 22:15:11 +0000 (17:15 -0500)
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
src/backend/utils/misc/guc.c

index 4e0d5959d19ca9852b60386d995b25af41a3ef8d..3131e827b82dd62c38f5bb0a48a74e6fc6b198da 100644 (file)
@@ -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,
index 29dac8e0fe63df71221270afbd6f547224d06407..c37c1d9a5fb42c1b4c19b7cf54718f751b695633 100644 (file)
@@ -1465,7 +1465,7 @@ static struct config_int ConfigureNamesInt[] =
                        GUC_UNIT_S
                },
                &XLogArchiveTimeout,
-               0, 0, INT_MAX,
+               0, 0, INT_MAX / 2,
                NULL, NULL, NULL
        },
        {
@@ -1475,7 +1475,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
        },
        {