summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-20 08:39:12 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-20 08:39:12 +0000
commit79881c94c2e66b1d3e98c5defb7919ba9e77d187 (patch)
treeb037bfd9f3815e6b167f5a9a95366eec903c142c
parent0cddf1b4331877019f65bf3ba572f7f8d0371115 (diff)
merge revision(s) 50541,50542: [Backport #11159]
* iseq.c (rb_iseq_compile_with_option): check srouce type, must be an IO or a String. [ruby-core:69219] [Bug #11159] * iseq.c (rb_iseq_compile_with_option): check source type, must be git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@50559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--iseq.c1
-rw-r--r--test/ruby/test_iseq.rb7
-rw-r--r--version.h6
4 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e7fd650d2..c6861afad2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed May 20 17:34:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * iseq.c (rb_iseq_compile_with_option): check source type, must be
+ an IO or a String. [ruby-core:69219] [Bug #11159]
+
Wed May 13 14:32:13 2015 Tanaka Akira <akr@fsij.org>
* lib/resolv.rb (Resolv::DNS::Label::Str#==): Check class equality.
diff --git a/iseq.c b/iseq.c
index 700a161f6b..4fbfe9edb4 100644
--- a/iseq.c
+++ b/iseq.c
@@ -610,6 +610,7 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE li
if (RB_TYPE_P((src), T_FILE))
node = rb_parser_compile_file_path(parser, file, src, ln);
else {
+ StringValue(src);
node = rb_parser_compile_string_path(parser, file, src, ln);
if (!node) {
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 4e3f6c1926..5fe90b0ebf 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -124,4 +124,11 @@ class TestISeq < Test::Unit::TestCase
ISeq.of(c.instance_method(:foobar)).label
assert_same a, b
end
+
+ def test_invalid_source
+ bug11159 = '[ruby-core:69219] [Bug #11159]'
+ assert_raise(TypeError, bug11159) {ISeq.compile(nil)}
+ assert_raise(TypeError, bug11159) {ISeq.compile(:foo)}
+ assert_raise(TypeError, bug11159) {ISeq.compile(1)}
+ end
end
diff --git a/version.h b/version.h
index 49f047cfb0..74842370d6 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#define RUBY_VERSION "2.1.7"
-#define RUBY_RELEASE_DATE "2015-05-13"
-#define RUBY_PATCHLEVEL 344
+#define RUBY_RELEASE_DATE "2015-05-20"
+#define RUBY_PATCHLEVEL 345
#define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 13
+#define RUBY_RELEASE_DAY 20
#include "ruby/version.h"