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
83925782
Commit
83925782
authored
Oct 02, 2018
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed SEGV from `eval` called form top-level `mrb_funcall()`; fix #4028
parent
e6841aba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
mrbgems/mruby-eval/src/eval.c
mrbgems/mruby-eval/src/eval.c
+13
-3
No files found.
mrbgems/mruby-eval/src/eval.c
View file @
83925782
...
@@ -226,7 +226,7 @@ create_proc_from_string(mrb_state *mrb, char *s, mrb_int len, mrb_value binding,
...
@@ -226,7 +226,7 @@ create_proc_from_string(mrb_state *mrb, char *s, mrb_int len, mrb_value binding,
struct
mrb_parser_state
*
p
;
struct
mrb_parser_state
*
p
;
struct
RProc
*
proc
;
struct
RProc
*
proc
;
struct
REnv
*
e
;
struct
REnv
*
e
;
mrb_callinfo
*
ci
=
&
mrb
->
c
->
ci
[
-
1
]
;
/* callinfo of eval caller */
mrb_callinfo
*
ci
;
/* callinfo of eval caller */
struct
RClass
*
target_class
=
NULL
;
struct
RClass
*
target_class
=
NULL
;
int
bidx
;
int
bidx
;
...
@@ -276,8 +276,16 @@ create_proc_from_string(mrb_state *mrb, char *s, mrb_int len, mrb_value binding,
...
@@ -276,8 +276,16 @@ create_proc_from_string(mrb_state *mrb, char *s, mrb_int len, mrb_value binding,
mrbc_context_free
(
mrb
,
cxt
);
mrbc_context_free
(
mrb
,
cxt
);
mrb_raise
(
mrb
,
E_SCRIPT_ERROR
,
"codegen error"
);
mrb_raise
(
mrb
,
E_SCRIPT_ERROR
,
"codegen error"
);
}
}
if
(
mrb
->
c
->
ci
>
mrb
->
c
->
cibase
)
{
ci
=
&
mrb
->
c
->
ci
[
-
1
];
}
else
{
ci
=
mrb
->
c
->
cibase
;
}
if
(
ci
->
proc
)
{
target_class
=
MRB_PROC_TARGET_CLASS
(
ci
->
proc
);
target_class
=
MRB_PROC_TARGET_CLASS
(
ci
->
proc
);
if
(
!
MRB_PROC_CFUNC_P
(
ci
->
proc
))
{
}
if
(
ci
->
proc
&&
!
MRB_PROC_CFUNC_P
(
ci
->
proc
))
{
if
(
ci
->
env
)
{
if
(
ci
->
env
)
{
e
=
ci
->
env
;
e
=
ci
->
env
;
}
}
...
@@ -315,10 +323,12 @@ exec_irep(mrb_state *mrb, mrb_value self, struct RProc *proc)
...
@@ -315,10 +323,12 @@ exec_irep(mrb_state *mrb, mrb_value self, struct RProc *proc)
/* no argument passed from eval() */
/* no argument passed from eval() */
mrb
->
c
->
ci
->
argc
=
0
;
mrb
->
c
->
ci
->
argc
=
0
;
if
(
mrb
->
c
->
ci
->
acc
<
0
)
{
if
(
mrb
->
c
->
ci
->
acc
<
0
)
{
ptrdiff_t
cioff
=
mrb
->
c
->
ci
-
mrb
->
c
->
cibase
;
mrb_value
ret
=
mrb_top_run
(
mrb
,
proc
,
self
,
0
);
mrb_value
ret
=
mrb_top_run
(
mrb
,
proc
,
self
,
0
);
if
(
mrb
->
exc
)
{
if
(
mrb
->
exc
)
{
mrb_exc_raise
(
mrb
,
mrb_obj_value
(
mrb
->
exc
));
mrb_exc_raise
(
mrb
,
mrb_obj_value
(
mrb
->
exc
));
}
}
mrb
->
c
->
ci
=
mrb
->
c
->
cibase
+
cioff
;
return
ret
;
return
ret
;
}
}
/* clear block */
/* clear block */
...
...
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