diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-04 13:26:39 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-04 13:26:39 +0000 |
commit | a4587840cc2b002321af227ee2cb315a94158d67 (patch) | |
tree | 84b83c13ab9f388bc0cc0b50608f045b8897df4c | |
parent | c3d1fde2b528413f5be2f936a9d7ea899a777fc7 (diff) | |
download | ruby-a4587840cc2b002321af227ee2cb315a94158d67.tar.gz |
* object.c (rb_mod_cvar_set): Reverted "avoid inadvertent
symbol creation" to avoid SEGV by
Class.new.class_variable_set(1, 2).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | object.c | 18 |
2 files changed, 10 insertions, 14 deletions
@@ -1,3 +1,9 @@ +Thu Apr 4 22:08:46 2013 Tanaka Akira <akr@fsij.org> + + * object.c (rb_mod_cvar_set): Reverted "avoid inadvertent + symbol creation" to avoid SEGV by + Class.new.class_variable_set(1, 2). + Thu Apr 4 20:07:19 2013 Tanaka Akira <akr@fsij.org> * ext/pathname/pathname.c (path_write): New method. @@ -2296,21 +2296,11 @@ rb_mod_cvar_get(VALUE obj, VALUE iv) static VALUE rb_mod_cvar_set(VALUE obj, VALUE iv, VALUE val) { - ID id; + ID id = rb_to_id(iv); - if (SYMBOL_P(iv)) { - id = SYM2ID(iv); - if (!rb_is_class_id(id)) { - rb_name_error(id, "`%"PRIsVALUE"' is not allowed as an class variable name", - QUOTE_ID(id)); - } - } - else if (!rb_is_class_id(iv)) { - rb_name_error_str(iv, "`%"PRIsVALUE"' is not allowed as a class variable name", - QUOTE(iv)); - } - else { - id = rb_to_id(iv); + if (!rb_is_class_id(id)) { + rb_name_error(id, "`%"PRIsVALUE"' is not allowed as a class variable name", + QUOTE_ID(id)); } rb_cvar_set(obj, id, val); return val; |