* error.c (exc_to_s): use OBJ_INFECT.

* error.c (name_err_to_s): ditto.

* error.c (name_err_mesg_to_str): ditto.

* error.c (syserr_initialize): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-10-12 12:39:22 +00:00
Родитель 628c802eae
Коммит 681e551369
2 изменённых файлов: 14 добавлений и 4 удалений

Просмотреть файл

@ -1,3 +1,13 @@
Tue Oct 12 19:25:13 2010 NARUSE, Yui <naruse@ruby-lang.org>
* error.c (exc_to_s): use OBJ_INFECT.
* error.c (name_err_to_s): ditto.
* error.c (name_err_mesg_to_str): ditto.
* error.c (syserr_initialize): ditto.
Tue Oct 12 19:07:55 2010 NARUSE, Yui <naruse@ruby-lang.org>
* error.c (syserr_initialize): taint message if mesg is given

Просмотреть файл

@ -501,7 +501,7 @@ exc_to_s(VALUE exc)
VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
if (OBJ_TAINTED(exc)) OBJ_TAINT(mesg);
OBJ_INFECT(mesg, exc);
return mesg;
}
@ -782,7 +782,7 @@ name_err_to_s(VALUE exc)
if (str != mesg) {
rb_iv_set(exc, "mesg", mesg = str);
}
if (OBJ_TAINTED(exc)) OBJ_TAINT(mesg);
OBJ_INFECT(mesg, exc);
return mesg;
}
@ -911,7 +911,7 @@ name_err_mesg_to_str(VALUE obj)
args[2] = d;
mesg = rb_f_sprintf(NAME_ERR_MESG_COUNT, args);
}
if (OBJ_TAINTED(obj)) OBJ_TAINT(mesg);
OBJ_INFECT(mesg, obj);
return mesg;
}
@ -1059,7 +1059,7 @@ syserr_initialize(int argc, VALUE *argv, VALUE self)
if (le != me && rb_enc_asciicompat(me))
le = me;
}/* else assume err is non ASCII string. */
if (OBJ_TAINTED(str)) OBJ_TAINT(mesg);
OBJ_INFECT(mesg, str);
rb_enc_associate(mesg, le);
}
else {