Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
4749e914
Commit
4749e914
authored
Jul 22, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix insufficient check for overflow in tm2abstime(), per report from jw.
parent
37c443ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
src/backend/utils/adt/nabstime.c
src/backend/utils/adt/nabstime.c
+8
-5
No files found.
src/backend/utils/adt/nabstime.c
View file @
4749e914
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.14
0 2005/07/22 03:46:33 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.14
1 2005/07/22 19:55:50 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -29,7 +29,7 @@
#include "utils/builtins.h"
#include "utils/nabstime.h"
#define MIN_DAYNUM
-24856
/* December 13, 1901 */
#define MIN_DAYNUM
(-24856)
/* December 13, 1901 */
#define MAX_DAYNUM 24854
/* January 18, 2038 */
#define INVALID_RELTIME_STR "Undefined RelTime"
...
...
@@ -201,9 +201,12 @@ tm2abstime(struct pg_tm *tm, int tz)
/* convert to seconds */
sec
=
tm
->
tm_sec
+
tz
+
(
tm
->
tm_min
+
(
day
*
HOURS_PER_DAY
+
tm
->
tm_hour
)
*
MINS_PER_HOUR
)
*
SECS_PER_MINUTE
;
/* check for overflow */
if
((
day
==
MAX_DAYNUM
&&
sec
<
0
)
||
(
day
==
MIN_DAYNUM
&&
sec
>
0
))
/*
* check for overflow. We need a little slop here because the H/M/S plus
* TZ offset could add up to more than 1 day.
*/
if
((
day
>=
MAX_DAYNUM
-
10
&&
sec
<
0
)
||
(
day
<=
MIN_DAYNUM
+
10
&&
sec
>
0
))
return
INVALID_ABSTIME
;
/* check for reserved values (e.g. "current" on edge of usual range */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment