diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-14 15:21:50 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-14 15:21:50 +0000 |
commit | b1944e41f5f5711e3b79bf08f2b54da1d7d6890b (patch) | |
tree | b43b85f34c2ddfa7e7f9a61673eb7a9bcbe685a3 | |
parent | 783f1b29087f4e8f11b873c1657dd927b0ecdd49 (diff) |
merge revision(s) 62772: [Backport #14738]
compile.c: fix load_from_binary
* compile.c (ibf_load_iseq_each): realpath may be nil. follow up
r59709. [fix https://github.com/Shopify/bootsnap/issues/132]
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@65728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | compile.c | 10 | ||||
-rw-r--r-- | test/ruby/test_iseq.rb | 8 | ||||
-rw-r--r-- | version.h | 6 |
3 files changed, 20 insertions, 4 deletions
@@ -8635,7 +8635,15 @@ ibf_load_iseq_each(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t of rb_raise(rb_eRuntimeError, "path object size mismatch"); } path = rb_fstring(RARRAY_AREF(pathobj, 0)); - realpath = rb_fstring(RARRAY_AREF(pathobj, 1)); + realpath = RARRAY_AREF(pathobj, 1); + if (!NIL_P(realpath)) { + if (!RB_TYPE_P(realpath, T_STRING)) { + rb_raise(rb_eArgError, "unexpected realpath %"PRIxVALUE + "(%x), path=%+"PRIsVALUE, + realpath, TYPE(realpath), path); + } + realpath = rb_fstring(realpath); + } } else { rb_raise(rb_eRuntimeError, "unexpected path object"); diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 404539ed7f..6d778d3ded 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -391,6 +391,14 @@ class TestISeq < Test::Unit::TestCase } end + def test_to_binary_with_objects + code = "[]"+100.times.map{|i|"<</#{i}/"}.join + iseq = RubyVM::InstructionSequence.compile(code) + bin = assert_nothing_raised {iseq.to_binary} + iseq2 = RubyVM::InstructionSequence.load_from_binary(bin) + assert_equal(iseq2.to_a, iseq.to_a) + end + def test_to_binary_tracepoint filename = "#{File.basename(__FILE__)}_#{__LINE__}" iseq = RubyVM::InstructionSequence.compile("x = 1\n y = 2", filename) @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.5.4" -#define RUBY_RELEASE_DATE "2018-11-07" -#define RUBY_PATCHLEVEL 111 +#define RUBY_RELEASE_DATE "2018-11-15" +#define RUBY_PATCHLEVEL 112 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 11 -#define RUBY_RELEASE_DAY 7 +#define RUBY_RELEASE_DAY 15 #include "ruby/version.h" |