From 999f6f820623b97b33733ce112aef91beb8918cc Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 17 Oct 2018 08:15:47 +0000 Subject: merge revision(s) 64915: [Backport #15205] 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/branches/ruby_2_4@65111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- iseq.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'iseq.c') diff --git a/iseq.c b/iseq.c index 07d8828e9b..9d1fdcc637 100644 --- a/iseq.c +++ b/iseq.c @@ -793,9 +793,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(""); + 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)); } -- cgit v1.2.3