diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-02 15:29:58 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-02 15:29:58 +0000 |
commit | cff48e4456ed67f1debadea38ae1041598b04222 (patch) | |
tree | a467989394e6c21edf914a3b992df84b945a5704 /gc.c | |
parent | 6faadd7838c4104583f3978b9a72cd07694df41b (diff) | |
download | ruby-cff48e4456ed67f1debadea38ae1041598b04222.tar.gz |
check an existence of block.
* gc.c (rb_raw_obj_info): check block before using it.
* vm_core.h (vm_block_iseq): r61565 introduced NULL check but this
check is only needed by `rb_raw_obj_info()` and it is called at GC
debug mode. Above fix for `rb_raw_obj_info()` solves this problem and
NULL check should not be needed any more.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -9346,8 +9346,12 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj) break; } case T_DATA: { + const struct rb_block *block; const rb_iseq_t *iseq; - if (rb_obj_is_proc(obj) && (iseq = vm_proc_iseq(obj)) != NULL) { + if (rb_obj_is_proc(obj) && + (block = vm_proc_block(obj)) != NULL && + (vm_block_type(block) == block_type_iseq) && + (iseq = vm_block_iseq(block)) != NULL) { rb_raw_iseq_info(buff, buff_size, iseq); } else { |