summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--gc.c2
-rw-r--r--string.c1
-rw-r--r--struct.c11
-rw-r--r--time.c1
-rw-r--r--variable.c5
6 files changed, 27 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 48fdbc2..5a25a00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/gc.c b/gc.c
index c221773..9e6a8f3 100644
--- a/gc.c
+++ b/gc.c
@@ -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;
diff --git a/string.c b/string.c
index c0bd42d..0f932a6 100644
--- a/string.c
+++ b/string.c
@@ -201,6 +201,7 @@ rb_str_new4(orig)
else {
str = str_new4(klass, orig);
}
+ OBJ_INFECT(str, orig);
OBJ_FREEZE(str);
return str;
}
diff --git a/struct.c b/struct.c
index b196123..6ff126e 100644
--- a/struct.c
+++ b/struct.c
@@ -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 */
}
diff --git a/time.c b/time.c
index 69f3127..81efe26 100644
--- a/time.c
+++ b/time.c
@@ -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) {
diff --git a/variable.c b/variable.c
index 15c75eb..506657e 100644
--- a/variable.c
+++ b/variable.c
@@ -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)) {