mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
iseq.c: undef allocator
* iseq.c (Init_ISeq): undefine allocator of InstructionSequence, to get rid of segfaults at method call on uninitialized object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
02a30129a1
commit
36b9a37a80
3 changed files with 10 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Aug 22 09:02:56 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* iseq.c (Init_ISeq): undefine allocator of InstructionSequence,
|
||||
to get rid of segfaults at method call on uninitialized object.
|
||||
|
||||
Sat Aug 21 05:47:00 2016 Kenta Murata <mrkn@mrkn.jp>
|
||||
|
||||
* enum.c (enum_sort): prevent wasteful array duplication.
|
||||
|
|
1
iseq.c
1
iseq.c
|
@ -2419,6 +2419,7 @@ Init_ISeq(void)
|
|||
{
|
||||
/* declare ::RubyVM::InstructionSequence */
|
||||
rb_cISeq = rb_define_class_under(rb_cRubyVM, "InstructionSequence", rb_cObject);
|
||||
rb_undef_alloc_func(rb_cISeq);
|
||||
rb_define_method(rb_cISeq, "inspect", iseqw_inspect, 0);
|
||||
rb_define_method(rb_cISeq, "disasm", iseqw_disasm, 0);
|
||||
rb_define_method(rb_cISeq, "disassemble", iseqw_disasm, 0);
|
||||
|
|
|
@ -19,6 +19,10 @@ class TestISeq < Test::Unit::TestCase
|
|||
body.find_all{|e| e.kind_of? Integer}
|
||||
end
|
||||
|
||||
def test_allocate
|
||||
assert_raise(TypeError) {ISeq.allocate}
|
||||
end
|
||||
|
||||
def test_to_a_lines
|
||||
src = <<-EOS
|
||||
p __LINE__ # 1
|
||||
|
|
Loading…
Reference in a new issue