mirror of
https://github.com/postgres/postgres.git
synced 2025-08-21 10:42:50 +03:00
Repair array subscript overrun identified by Yichen Xie. Reduce the
value of MAX_TIME_PRECISION in floating-point-timestamp-storage case from 13 to 10, which is as much as time_out is actually willing to print. (The alternative of increasing the number of digits we are willing to print looks risky; we might find ourselves printing roundoff garbage.)
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.76 2003/01/22 20:44:20 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.77 2003/01/29 01:08:42 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -619,7 +619,7 @@ static void
|
||||
AdjustTimeForTypmod(TimeADT *time, int32 typmod)
|
||||
{
|
||||
#ifdef HAVE_INT64_TIMESTAMP
|
||||
static const int64 TimeScales[MAX_TIMESTAMP_PRECISION + 1] = {
|
||||
static const int64 TimeScales[MAX_TIME_PRECISION + 1] = {
|
||||
INT64CONST(1000000),
|
||||
INT64CONST(100000),
|
||||
INT64CONST(10000),
|
||||
@@ -629,7 +629,7 @@ AdjustTimeForTypmod(TimeADT *time, int32 typmod)
|
||||
INT64CONST(1)
|
||||
};
|
||||
|
||||
static const int64 TimeOffsets[MAX_TIMESTAMP_PRECISION + 1] = {
|
||||
static const int64 TimeOffsets[MAX_TIME_PRECISION + 1] = {
|
||||
INT64CONST(500000),
|
||||
INT64CONST(50000),
|
||||
INT64CONST(5000),
|
||||
@@ -640,14 +640,19 @@ AdjustTimeForTypmod(TimeADT *time, int32 typmod)
|
||||
};
|
||||
|
||||
#else
|
||||
static const double TimeScales[MAX_TIMESTAMP_PRECISION + 1] = {
|
||||
/* note MAX_TIME_PRECISION differs in this case */
|
||||
static const double TimeScales[MAX_TIME_PRECISION + 1] = {
|
||||
1,
|
||||
10,
|
||||
100,
|
||||
1000,
|
||||
10000,
|
||||
100000,
|
||||
1000000
|
||||
1000000,
|
||||
10000000,
|
||||
100000000,
|
||||
1000000000,
|
||||
10000000000
|
||||
};
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user