diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-19 02:19:45 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-19 02:19:45 +0000 |
commit | 0ce3fab42233dad9a35573f1a702dabd1f1b6242 () | |
tree | d3e0b148629d6a8c7e14eaeed0499ba6ecb2bdca | |
parent | 5707ba30aa8a4d693bc173d13735a90c216988e7 (diff) |
variable.c: consider length
* variable.c (rb_path_to_class): consider the string length instead of a terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_marshal.rb | 10 | ||||
-rw-r--r-- | variable.c | 13 |
3 files changed, 17 insertions, 11 deletions
@@ -1,4 +1,7 @@ -Sun Jun 19 10:54:40 2016 Nobuyoshi Nakada <[email protected]> * variable.c (rb_path_to_class): search the constant at once instead of checking if defined and then getting it. @@ -719,10 +719,12 @@ class TestMarshal < Test::Unit::TestCase end def test_marshal_load_extended_class_crash - crash = "\x04\be:\x0F\x00omparableo:\vObject\x00" - - opt = %w[--disable=gems] - assert_ruby_status(opt, "Marshal.load(#{crash.dump})") end def test_marshal_load_r_prepare_reference_crash @@ -389,7 +389,7 @@ VALUE rb_path_to_class(VALUE pathname) { rb_encoding *enc = rb_enc_get(pathname); - const char *pbeg, *p, *path = RSTRING_PTR(pathname); ID id; VALUE c = rb_cObject; @@ -397,15 +397,16 @@ rb_path_to_class(VALUE pathname) rb_raise(rb_eArgError, "invalid class path encoding (non ASCII)"); } pbeg = p = path; - if (path[0] == '#') { rb_raise(rb_eArgError, "can't retrieve anonymous class %"PRIsVALUE, QUOTE(pathname)); } - while (*p) { - while (*p && *p != ':') p++; id = rb_check_id_cstr(pbeg, p-pbeg, enc); - if (p[0] == ':') { - if (p[1] != ':') goto undefined_class; p += 2; pbeg = p; } |