diff options
author | Tom Lane | 2008-01-23 21:26:20 +0000 |
---|---|---|
committer | Tom Lane | 2008-01-23 21:26:20 +0000 |
commit | 0027ee81f3fc36cb647ebd75971a16898cd3c3ad (patch) | |
tree | e408273c8fa6e406ea3f3bae39d4d778945d7aa7 | |
parent | 0bec77e4a25cd3c733be9bb3b42028ccd4f3a4f4 (diff) |
Prevent integer overflow within the integer-datetimes version of
TimestampTzPlusMilliseconds. An integer argument of more than INT_MAX/1000
milliseconds (ie, about 35 minutes) would provoke a wrong result, resulting
in incorrect enforcement of statement_timestamp values larger than that.
Bug was introduced in my rewrite of 2006-06-20, which fixed some other
overflow risks, but missed this one :-( Per report from Elein.
-rw-r--r-- | src/include/utils/timestamp.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h index 6eec76d8e0..e8603ecbf9 100644 --- a/src/include/utils/timestamp.h +++ b/src/include/utils/timestamp.h @@ -182,7 +182,7 @@ typedef double fsec_t; #define INTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK) #ifdef HAVE_INT64_TIMESTAMP -#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) * 1000)) +#define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) * (int64) 1000)) #else #define TimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) / 1000.0)) #endif |