aboutsummaryrefslogtreecommitdiffstats
path: root/iseq.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-04 15:22:53 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-04 15:22:53 +0000
commit04d01a64baac775bade8090f8135cd90651764df (patch)
treeca75de999cb8e77f66a808033a2cea7e7967a5e4 /iseq.c
parentd1ecf011b8fae8d07ea23cf7678ead9b1cf61219 (diff)
downloadruby-04d01a64baac775bade8090f8135cd90651764df.tar.gz
check argument type.
* iseq.c (iseqw_s_compile): check argument type (T_STRING) to avoid SEGV. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/iseq.c b/iseq.c
index 20c5fff2f2..831a9e8109 100644
--- a/iseq.c
+++ b/iseq.c
@@ -1075,9 +1075,14 @@ iseqw_s_compile(int argc, VALUE *argv, VALUE self)
case 3: path = argv[--i];
case 2: file = argv[--i];
}
+
if (NIL_P(file)) file = rb_fstring_cstr("<compiled>");
+ if (NIL_P(path)) path = file;
if (NIL_P(line)) line = INT2FIX(1);
+ Check_Type(path, T_STRING);
+ Check_Type(file, T_STRING);
+
return iseqw_new(rb_iseq_compile_with_option(src, file, path, line, 0, opt));
}