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
c85feaec
Commit
c85feaec
authored
Dec 09, 2016
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Dec 09, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3337 from bouk/undef-127
Fix segfault when undef is called with more than 126 arguments
parents
db6b6ff4
c8da3c4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
+20
-2
test/t/codegen.rb
test/t/codegen.rb
+10
-0
No files found.
mrbgems/mruby-compiler/core/codegen.c
View file @
c85feaec
...
...
@@ -2560,13 +2560,31 @@ codegen(codegen_scope *s, node *tree, int val)
genop
(
s
,
MKOP_A
(
OP_TCLASS
,
cursp
()));
push
();
while
(
t
)
{
int
symbol
=
new_msym
(
s
,
sym
(
t
->
car
));
int
symbol
;
if
(
num
>=
CALL_MAXARGS
-
1
)
{
pop_n
(
num
);
genop
(
s
,
MKOP_ABC
(
OP_ARRAY
,
cursp
(),
cursp
(),
num
));
while
(
t
)
{
symbol
=
new_msym
(
s
,
sym
(
t
->
car
));
push
();
genop
(
s
,
MKOP_ABx
(
OP_LOADSYM
,
cursp
(),
symbol
));
pop
();
genop
(
s
,
MKOP_AB
(
OP_ARYPUSH
,
cursp
(),
cursp
()
+
1
));
t
=
t
->
cdr
;
}
num
=
CALL_MAXARGS
;
break
;
}
symbol
=
new_msym
(
s
,
sym
(
t
->
car
));
genop
(
s
,
MKOP_ABx
(
OP_LOADSYM
,
cursp
(),
symbol
));
push
();
t
=
t
->
cdr
;
num
++
;
}
pop_n
(
num
+
1
);
pop
();
if
(
num
<
CALL_MAXARGS
)
{
pop_n
(
num
);
}
genop
(
s
,
MKOP_ABC
(
OP_SEND
,
cursp
(),
undef
,
num
));
if
(
val
)
{
push
();
...
...
test/t/codegen.rb
View file @
c85feaec
...
...
@@ -63,3 +63,13 @@ assert('splat in case splat') do
assert_equal [1], a
end
assert('undef with 127 or more arguments') do
assert_raise NameError do
undef
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, 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