1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (rb_str_new4): should propagate taintedness.

* struct.c (rb_struct_set): use original method name, not callee
  name, to retrieve member slot.  [ruby-core:04268]

* time.c (time_strftime): protect from format modification from GC
  finalizers.

* gc.c (rb_data_object_alloc): klass may be NULL.
  [ruby-list:40498]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2005-01-20 09:34:36 +00:00
parent 3f89d1660a
commit dcd87b140c
6 changed files with 27 additions and 8 deletions

View file

@ -1,3 +1,13 @@
Thu Jan 20 11:42:02 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_new4): should propagate taintedness.
* struct.c (rb_struct_set): use original method name, not callee
name, to retrieve member slot. [ruby-core:04268]
* time.c (time_strftime): protect from format modification from GC
finalizers.
Wed Jan 19 18:06:40 2005 NAKAMURA Usaku <usa@ruby-lang.org>
* lib/ipaddr.rb (to_s, test_to_s): too many colons with some cases.
@ -96,6 +106,11 @@ Mon Jan 10 23:08:15 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* variable.c (rb_autoload): hide internal data from ruby level.
fixed: [ruby-dev:25435], [ruby-list:40498]
Mon Jan 10 01:22:55 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (rb_data_object_alloc): klass may be NULL.
[ruby-list:40498]
Sun Jan 9 03:12:58 2005 Tanaka Akira <akr@m17n.org>
* io.c (io_fread): warn nonblocking behavior.

2
gc.c
View file

@ -398,7 +398,7 @@ rb_data_object_alloc(klass, datap, dmark, dfree)
RUBY_DATA_FUNC dfree;
{
NEWOBJ(data, struct RData);
Check_Type(klass, T_CLASS);
if (klass) Check_Type(klass, T_CLASS);
OBJSETUP(data, klass, T_DATA);
data->data = datap;
data->dfree = dfree;

View file

@ -201,6 +201,7 @@ rb_str_new4(orig)
else {
str = str_new4(klass, orig);
}
OBJ_INFECT(str, orig);
OBJ_FREEZE(str);
return str;
}

View file

@ -11,6 +11,7 @@
**********************************************************************/
#include "ruby.h"
#include "env.h"
VALUE rb_cStruct;
@ -118,7 +119,7 @@ static VALUE
rb_struct_ref(obj)
VALUE obj;
{
return rb_struct_getmember(obj, rb_frame_last_func());
return rb_struct_getmember(obj, ruby_frame->orig_func);
}
static VALUE rb_struct_ref0(obj) VALUE obj; {return RSTRUCT(obj)->ptr[0];}
@ -159,18 +160,20 @@ rb_struct_set(obj, val)
VALUE obj, val;
{
VALUE members, slot;
ID id;
long i;
members = rb_struct_members(obj);
rb_struct_modify(obj);
id = ruby_frame->orig_func;
for (i=0; i<RARRAY(members)->len; i++) {
slot = RARRAY(members)->ptr[i];
if (rb_id_attrset(SYM2ID(slot)) == rb_frame_last_func()) {
if (rb_id_attrset(SYM2ID(slot)) == id) {
return RSTRUCT(obj)->ptr[i] = val;
}
}
rb_name_error(rb_frame_last_func(), "`%s' is not a struct member",
rb_id2name(rb_frame_last_func()));
rb_name_error(ruby_frame->last_func, "`%s' is not a struct member",
rb_id2name(id));
return Qnil; /* not reached */
}

1
time.c
View file

@ -1829,6 +1829,7 @@ time_strftime(time, format)
time_get_tm(time, tobj->gmt);
}
StringValue(format);
format = rb_str_new4(format);
fmt = RSTRING(format)->ptr;
len = RSTRING(format)->len;
if (len == 0) {

View file

@ -1289,8 +1289,7 @@ rb_autoload(mod, id, file)
tbl = check_autoload_table(av);
}
else {
av = Data_Wrap_Struct(rb_cData, rb_mark_tbl, st_free_table, 0);
RBASIC(av)->klass = 0;
av = Data_Wrap_Struct(0 , rb_mark_tbl, st_free_table, 0);
st_add_direct(tbl, autoload, av);
DATA_PTR(av) = tbl = st_init_numtable();
}
@ -1356,7 +1355,7 @@ autoload_file(mod, id)
}
file = ((NODE *)load)->nd_lit;
Check_Type(file, T_STRING);
if (!RSTRING(file)->ptr) {
if (!RSTRING(file)->ptr || !*RSTRING(file)->ptr) {
rb_raise(rb_eArgError, "empty file name");
}
if (!rb_provided(RSTRING(file)->ptr)) {