Skip to content

Commit

Permalink
merge revision(s) 62772: [Backport #14738]
Browse files Browse the repository at this point in the history
	compile.c: fix load_from_binary

	* compile.c (ibf_load_iseq_each): realpath may be nil.  follow up
	  r59709.  [fix Shopify/bootsnap#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
  • Loading branch information
nagachika committed Nov 14, 2018
1 parent 783f1b2 commit b1944e4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
10 changes: 9 additions & 1 deletion compile.c
Expand Up @@ -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");
Expand Down
8 changes: 8 additions & 0 deletions test/ruby/test_iseq.rb
Expand Up @@ -391,6 +391,14 @@ class C # line 7 empty class
}
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)
Expand Down
6 changes: 3 additions & 3 deletions version.h
@@ -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"

Expand Down

0 comments on commit b1944e4

Please sign in to comment.