From 7d34ed6ecb9506847c4c85170d8df351b5678ad0 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 1 Mar 2018 00:37:47 +0000 Subject: 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 3 ++- test/ruby/test_iseq.rb | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compile.c b/compile.c index 33ffe17e54..111aef5293 100644 --- a/compile.c +++ b/compile.c @@ -8708,7 +8708,8 @@ 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)) 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 4c811611ba..1a45778cc4 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -398,10 +398,9 @@ class TestISeq < Test::Unit::TestCase def test_to_binary_with_objects code = "[]"+100.times.map{|i|"<