Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb9ff744

Browse files
committed
Prevent integer overflow within the integer-datetimes version of
TimestampTzPlusMilliseconds. An integer argument of more than INT_MAX/1000milliseconds (ie, about 35 minutes) would provoke a wrong result, resultingin incorrect enforcement of statement_timestamp values larger than that.Bug was introduced in my rewrite of 2006-06-20, which fixed some otheroverflow risks, but missed this one :-( Per report from Elein.
1 parent1570d04 commitb9ff744

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/include/utils/timestamp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.73 2008/01/01 19:45:59 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.74 2008/01/23 21:26:13 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -182,7 +182,7 @@ typedef double fsec_t;
182182
#defineINTERVAL_RANGE(t) (((t) >> 16) & INTERVAL_RANGE_MASK)
183183

184184
#ifdefHAVE_INT64_TIMESTAMP
185-
#defineTimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) * 1000))
185+
#defineTimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) *(int64)1000))
186186
#else
187187
#defineTimestampTzPlusMilliseconds(tz,ms) ((tz) + ((ms) / 1000.0))
188188
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp