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
d3a02a29
Commit
d3a02a29
authored
Apr 22, 2020
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `instance_exec` and `class_exec` to avoid crash on indirect calls.
Thank you @shuujii to additional report on #4973
parent
ab508e1e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
13 deletions
+9
-13
mrbgems/mruby-class-ext/src/class.c
mrbgems/mruby-class-ext/src/class.c
+6
-1
mrbgems/mruby-object-ext/src/object.c
mrbgems/mruby-object-ext/src/object.c
+3
-12
No files found.
mrbgems/mruby-class-ext/src/class.c
View file @
d3a02a29
...
@@ -43,10 +43,15 @@ mrb_mod_module_exec(mrb_state *mrb, mrb_value self)
...
@@ -43,10 +43,15 @@ mrb_mod_module_exec(mrb_state *mrb, mrb_value self)
const
mrb_value
*
argv
;
const
mrb_value
*
argv
;
mrb_int
argc
;
mrb_int
argc
;
mrb_value
blk
;
mrb_value
blk
;
struct
RClass
*
c
;
mrb_get_args
(
mrb
,
"*&!"
,
&
argv
,
&
argc
,
&
blk
);
mrb_get_args
(
mrb
,
"*&!"
,
&
argv
,
&
argc
,
&
blk
);
mrb
->
c
->
ci
->
target_class
=
mrb_class_ptr
(
self
);
c
=
mrb_class_ptr
(
self
);
if
(
mrb
->
c
->
ci
->
acc
<
0
)
{
return
mrb_yield_with_class
(
mrb
,
blk
,
argc
,
argv
,
self
,
c
);
}
mrb
->
c
->
ci
->
target_class
=
c
;
return
mrb_yield_cont
(
mrb
,
blk
,
self
,
argc
,
argv
);
return
mrb_yield_cont
(
mrb
,
blk
,
self
,
argc
,
argv
);
}
}
...
...
mrbgems/mruby-object-ext/src/object.c
View file @
d3a02a29
...
@@ -101,18 +101,9 @@ mrb_obj_instance_exec(mrb_state *mrb, mrb_value self)
...
@@ -101,18 +101,9 @@ mrb_obj_instance_exec(mrb_state *mrb, mrb_value self)
struct
RClass
*
c
;
struct
RClass
*
c
;
mrb_get_args
(
mrb
,
"*&!"
,
&
argv
,
&
argc
,
&
blk
);
mrb_get_args
(
mrb
,
"*&!"
,
&
argv
,
&
argc
,
&
blk
);
c
=
mrb_singleton_class_ptr
(
mrb
,
self
);
switch
(
mrb_type
(
self
))
{
if
(
mrb
->
c
->
ci
->
acc
<
0
)
{
case
MRB_TT_SYMBOL
:
return
mrb_yield_with_class
(
mrb
,
blk
,
argc
,
argv
,
self
,
c
);
case
MRB_TT_FIXNUM
:
#ifndef MRB_WITHOUT_FLOAT
case
MRB_TT_FLOAT
:
#endif
c
=
NULL
;
break
;
default:
c
=
mrb_class_ptr
(
mrb_singleton_class
(
mrb
,
self
));
break
;
}
}
mrb
->
c
->
ci
->
target_class
=
c
;
mrb
->
c
->
ci
->
target_class
=
c
;
return
mrb_yield_cont
(
mrb
,
blk
,
self
,
argc
,
argv
);
return
mrb_yield_cont
(
mrb
,
blk
,
self
,
argc
,
argv
);
...
...
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