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
22f55040
Unverified
Commit
22f55040
authored
Nov 14, 2016
by
Bouke van der Bijl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix segfault on remove_method with invalid argument
Reported by
https://hackerone.com/jpenalbae
parent
a630c4f4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
src/class.c
src/class.c
+1
-1
test/t/class.rb
test/t/class.rb
+9
-0
No files found.
src/class.c
View file @
22f55040
...
...
@@ -2068,7 +2068,7 @@ mrb_mod_remove_method(mrb_state *mrb, mrb_value mod)
mrb_get_args
(
mrb
,
"*"
,
&
argv
,
&
argc
);
while
(
argc
--
)
{
remove_method
(
mrb
,
mod
,
mrb_symbol
(
*
argv
));
remove_method
(
mrb
,
mod
,
to_sym
(
mrb
,
*
argv
));
argv
++
;
}
return
mod
;
...
...
test/t/class.rb
View file @
22f55040
...
...
@@ -401,3 +401,12 @@ assert('class with non-class/module outer raises TypeError') do
assert_raise
(
TypeError
)
{
class
0::C1
;
end
}
assert_raise
(
TypeError
)
{
class
[]
::
C2
;
end
}
end
assert
(
"remove_method doesn't segfault if the passed in argument isn't a symbol"
)
do
klass
=
Class
.
new
assert_raise
(
TypeError
)
{
klass
.
remove_method
nil
}
assert_raise
(
TypeError
)
{
klass
.
remove_method
123
}
assert_raise
(
TypeError
)
{
klass
.
remove_method
1.23
}
assert_raise
(
NameError
)
{
klass
.
remove_method
"hello"
}
assert_raise
(
TypeError
)
{
klass
.
remove_method
Class
.
new
}
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