summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-16 02:27:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-16 02:27:50 +0000
commitddf295a26f610affd3a22da91852b52594a6477c (patch)
treea26d62926d686d9cae0888079d38bc5978236a28 /compile.c
parentd3c5746bbb3807a4ccc10ae5da57792aa3f3459e (diff)
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/trunk@62772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 17974b26c0..18abaca22b 100644
--- a/compile.c
+++ b/compile.c
@@ -8773,7 +8773,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");