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
f6663506
Commit
f6663506
authored
Nov 26, 2016
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Nov 26, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3295 from bouk/time-seg
Fix null pointer dereference in mrb_time_initialize
parents
0ee58a0f
b7f9a587
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
mrbgems/mruby-time/src/time.c
mrbgems/mruby-time/src/time.c
+2
-2
mrbgems/mruby-time/test/time.rb
mrbgems/mruby-time/test/time.rb
+11
-0
No files found.
mrbgems/mruby-time/src/time.c
View file @
f6663506
...
...
@@ -587,14 +587,14 @@ mrb_time_initialize(mrb_state *mrb, mrb_value self)
int
n
;
struct
mrb_time
*
tm
;
n
=
mrb_get_args
(
mrb
,
"|iiiiiii"
,
&
ayear
,
&
amonth
,
&
aday
,
&
ahour
,
&
amin
,
&
asec
,
&
ausec
);
tm
=
(
struct
mrb_time
*
)
DATA_PTR
(
self
);
if
(
tm
)
{
mrb_free
(
mrb
,
tm
);
}
mrb_data_init
(
self
,
NULL
,
&
mrb_time_type
);
n
=
mrb_get_args
(
mrb
,
"|iiiiiii"
,
&
ayear
,
&
amonth
,
&
aday
,
&
ahour
,
&
amin
,
&
asec
,
&
ausec
);
if
(
n
==
0
)
{
tm
=
current_mrb_time
(
mrb
);
}
...
...
mrbgems/mruby-time/test/time.rb
View file @
f6663506
...
...
@@ -211,3 +211,14 @@ assert('2000 times 500us make a second') do
end
t
.
usec
==
0
end
assert
(
"Time#initialize doens't leave uninitialized object accessible"
)
do
assert_raise
ArgumentError
do
$x
=
Time
.
new
a
=
Object
.
new
def
a
.
to_i
$x
.
mday
end
$x
.
initialize
a
end
end
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