mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* proc.c (proc_binding): fix segmentation fault on marking phase.
envptr of newenvval should not be NULL. You can reproduce by make test-all TESTS='--gc-stress -n test_to_proc_binding ruby/test_method.rb' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d88957abad
commit
280d4c3733
2 changed files with 12 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
|||
Sun May 10 16:23:58 2015 Kazuki Tsujimoto <kazuki@callcc.net>
|
||||
|
||||
* proc.c (proc_binding): fix segmentation fault on marking phase.
|
||||
envptr of newenvval should not be NULL.
|
||||
|
||||
You can reproduce by
|
||||
make test-all TESTS='--gc-stress -n test_to_proc_binding ruby/test_method.rb'
|
||||
|
||||
Sun May 10 12:41:18 2015 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* ext/zlib/zlib.c (rb_gzreader_external_encoding):
|
||||
|
|
7
proc.c
7
proc.c
|
@ -2510,15 +2510,16 @@ proc_binding(VALUE self)
|
|||
if (iseq && env->local_size < iseq->local_size) {
|
||||
int prev_local_size = env->local_size;
|
||||
int local_size = iseq->local_size;
|
||||
VALUE newenvval = TypedData_Wrap_Struct(RBASIC_CLASS(envval), RTYPEDDATA_TYPE(envval), 0);
|
||||
rb_env_t *newenv = xmalloc(sizeof(rb_env_t) + ((local_size + 1) * sizeof(VALUE)));
|
||||
RTYPEDDATA_DATA(newenvval) = newenv;
|
||||
rb_env_t *newenv;
|
||||
VALUE newenvval;
|
||||
newenv = xmalloc(sizeof(rb_env_t) + ((local_size + 1) * sizeof(VALUE)));
|
||||
newenv->env_size = local_size + 2;
|
||||
newenv->local_size = local_size;
|
||||
newenv->prev_envval = env->prev_envval;
|
||||
newenv->block = env->block;
|
||||
MEMCPY(newenv->env, env->env, VALUE, prev_local_size + 1);
|
||||
rb_mem_clear(newenv->env + prev_local_size + 1, local_size - prev_local_size);
|
||||
newenvval = TypedData_Wrap_Struct(RBASIC_CLASS(envval), RTYPEDDATA_TYPE(envval), newenv);
|
||||
newenv->env[local_size + 1] = newenvval;
|
||||
envval = newenvval;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue