Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
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
Libraries
mruby
Commits
6a796cb4
Commit
6a796cb4
authored
Jun 17, 2015
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a check for 64 bit time_t overflow; based on a patch from @kext; close #2836
parent
6dcc3e73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
mrbgems/mruby-time/src/time.c
mrbgems/mruby-time/src/time.c
+5
-2
No files found.
mrbgems/mruby-time/src/time.c
View file @
6a796cb4
...
...
@@ -201,11 +201,14 @@ time_alloc(mrb_state *mrb, double sec, double usec, enum mrb_timezone timezone)
struct
mrb_time
*
tm
;
tm
=
(
struct
mrb_time
*
)
mrb_malloc
(
mrb
,
sizeof
(
struct
mrb_time
));
tm
->
sec
=
(
time_t
)
sec
;
if
(
sizeof
(
time_t
)
==
4
&&
(
sec
>
(
double
)
INT32_MAX
||
(
double
)
INT32_MIN
>
sec
))
{
goto
out_of_range
;
}
else
if
((
sec
>
0
&&
tm
->
sec
<
0
)
||
(
sec
<
0
&&
(
double
)
tm
->
sec
>
sec
))
{
if
(
sizeof
(
time_t
)
==
8
&&
(
sec
>
(
double
)
INT64_MAX
||
(
double
)
INT64_MIN
>
sec
))
{
goto
out_of_range
;
}
tm
->
sec
=
(
time_t
)
sec
;
if
((
sec
>
0
&&
tm
->
sec
<
0
)
||
(
sec
<
0
&&
(
double
)
tm
->
sec
>
sec
))
{
out_of_range:
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"%S out of Time range"
,
mrb_float_value
(
mrb
,
sec
));
}
...
...
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