summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-09 06:14:41 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-09 06:14:41 (GMT)
commit76a929a7fca3c84630574e4daa9dab7a96b04fc8 (patch)
treea9cd02b421dd1e70fd8e478589f93ae94af9af23 /object.c
parent37f018fdf52d0f75d66d467055f992dee1c0a420 (diff)
* parse.y: change Symbol <-> ID relationship to avoid
exposing IDs from collectable symbols. [Bug #10014] Now, rb_check_id() returns 0 if corresponding symbol is pinned dynamic symbol. There is remaining intern_cstr_without_pindown(), it can return IDs from collectable symbols. We must be careful to use it (only used in parse.y). I think it should be removed if it does not have impact for performance. * parse.y: add: * STATIC_SYM2ID() * STATIC_ID2SYM() rename: * rb_pin_dynamic_symbol() -> dsymbol_pindown() * internal.h: remove: * rb_check_id_without_pindown() * rb_sym2id_without_pindown() add: * rb_check_symbol() * rb_check_symbol_cstr() * load.c: use rb_check_id() or rb_check_id_cstr(). * object.c: ditto. * struct.c: ditto. * thread.c: ditto. * vm_method.c: ditto. * string.c (sym_find): use only rb_check_symbol(). * sprintf.c (rb_str_format): use rb_check_symbol_cstr(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/object.c b/object.c
index a154d02..84360ac 100644
--- a/object.c
+++ b/object.c
@@ -2135,7 +2135,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
if (pbeg == p) goto wrong_name;
- id = rb_check_id_cstr_without_pindown(pbeg, len = p-pbeg, enc);
+ id = rb_check_id_cstr(pbeg, len = p-pbeg, enc);
beglen = pbeg-path;
if (p < pend && p[0] == ':') {
@@ -2277,7 +2277,7 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod)
if (pbeg == p) goto wrong_name;
- id = rb_check_id_cstr_without_pindown(pbeg, len = p-pbeg, enc);
+ id = rb_check_id_cstr(pbeg, len = p-pbeg, enc);
beglen = pbeg-path;
if (p < pend && p[0] == ':') {
@@ -2348,7 +2348,7 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod)
static VALUE
rb_obj_ivar_get(VALUE obj, VALUE iv)
{
- ID id = rb_check_id_without_pindown(&iv);
+ ID id = rb_check_id(&iv);
if (!id) {
if (rb_is_instance_name(iv)) {
@@ -2419,7 +2419,7 @@ rb_obj_ivar_set(VALUE obj, VALUE iv, VALUE val)
static VALUE
rb_obj_ivar_defined(VALUE obj, VALUE iv)
{
- ID id = rb_check_id_without_pindown(&iv);
+ ID id = rb_check_id(&iv);
if (!id) {
if (rb_is_instance_name(iv)) {
@@ -2456,7 +2456,7 @@ rb_obj_ivar_defined(VALUE obj, VALUE iv)
static VALUE
rb_mod_cvar_get(VALUE obj, VALUE iv)
{
- ID id = rb_check_id_without_pindown(&iv);
+ ID id = rb_check_id(&iv);
if (!id) {
if (rb_is_class_name(iv)) {
@@ -2522,7 +2522,7 @@ rb_mod_cvar_set(VALUE obj, VALUE iv, VALUE val)
static VALUE
rb_mod_cvar_defined(VALUE obj, VALUE iv)
{
- ID id = rb_check_id_without_pindown(&iv);
+ ID id = rb_check_id(&iv);
if (!id) {
if (rb_is_class_name(iv)) {