1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
ko1 2018-10-04 15:22:53 +00:00
parent 103a0b9869
commit daf194745b

5
iseq.c
View file

@ -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));
}