summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog19
-rw-r--r--ext/stringio/stringio.c13
-rw-r--r--ruby.c3
3 files changed, 26 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 10e26b5d85..7d29ef79b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Thu Nov 6 10:17:51 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_set_string, strio_reopen): check
+ tainted.
+
+ * ext/stringio/stringio.c (strio_copy, strio_ungetc, strio_write,
+ strio_putc): add infection.
+
+ * ext/stringio/stringio.c (strio_path): just nil. [ruby-dev:21846]
+
+ * ruby.c (proc_options): reserve searched script path in the
+ source file name table. [ruby-list:38765]
+
Wed Nov 5 23:49:45 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* sample/openssl/gen_csr.rb: there (at least) is a CA which does not
@@ -5,15 +18,15 @@ Wed Nov 5 23:49:45 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
Wed Nov 5 22:55:16 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * configure.in, eval.c, signal.c: : add '--with-pthread-ext'
+ * configure.in, eval.c, signal.c: : add '--with-pthread-ext'
option to fix the pthread trouble on 'tcltklib'
* ext/tcltklib/README.1st: add the description of '--with-pthread-ext'
- * ext/tk/lib/tktext.rb : add TkText#text_copy, text_cut, text_paste
+ * ext/tk/lib/tktext.rb : add TkText#text_copy, text_cut, text_paste
to support Tcl/Tk8.4's tk_textCopy, tk_textCut, tk_textPaste
- * ext/tk/lib/tk.rb : add TkMenu#set_focus support Tcl/Tk's
+ * ext/tk/lib/tk.rb : add TkMenu#set_focus support Tcl/Tk's
tk_menuSetFocus
Wed Nov 5 19:08:47 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 5f824e3f58..6dd68fdb40 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -148,7 +148,6 @@ static VALUE strio_closed _((VALUE));
static VALUE strio_closed_read _((VALUE));
static VALUE strio_closed_write _((VALUE));
static VALUE strio_eof _((VALUE));
-/* static VALUE strio_become _((VALUE, VALUE)); NOT USED */
static VALUE strio_get_lineno _((VALUE));
static VALUE strio_set_lineno _((VALUE, VALUE));
static VALUE strio_get_pos _((VALUE));
@@ -156,7 +155,6 @@ static VALUE strio_set_pos _((VALUE, VALUE));
static VALUE strio_rewind _((VALUE));
static VALUE strio_seek _((int, VALUE *, VALUE));
static VALUE strio_get_sync _((VALUE));
-/* static VALUE strio_set_sync _((VALUE, VALUE)); NOT USED */
static VALUE strio_each_byte _((VALUE));
static VALUE strio_getc _((VALUE));
static VALUE strio_ungetc _((VALUE, VALUE));
@@ -167,8 +165,6 @@ static VALUE strio_readline _((int, VALUE *, VALUE));
static VALUE strio_each _((int, VALUE *, VALUE));
static VALUE strio_readlines _((int, VALUE *, VALUE));
static VALUE strio_write _((VALUE, VALUE));
-/* static VALUE strio_print _((int, VALUE *, VALUE)); NOT USED */
-/* static VALUE strio_printf _((int, VALUE *, VALUE)); NOT USED */
static VALUE strio_putc _((VALUE, VALUE));
static VALUE strio_read _((int, VALUE *, VALUE));
static VALUE strio_size _((VALUE));
@@ -317,6 +313,7 @@ strio_set_string(self, string)
{
struct StringIO *ptr = StringIO(self);
+ if (!OBJ_TAINTED(self)) rb_secure(4);
ptr->flags &= ~FMODE_READWRITE;
if (!NIL_P(string)) {
StringValue(string);
@@ -417,6 +414,7 @@ strio_copy(copy, orig)
strio_free(DATA_PTR(copy));
}
DATA_PTR(copy) = ptr;
+ OBJ_INFECT(copy, orig);
++ptr->count;
return copy;
}
@@ -450,7 +448,7 @@ strio_reopen(argc, argv, self)
VALUE *argv;
VALUE self;
{
- rb_secure(4);
+ if (!OBJ_TAINTED(self)) rb_secure(4);
if (argc == 1 && TYPE(*argv) != T_STRING) {
return strio_copy(self, *argv);
}
@@ -577,6 +575,7 @@ strio_ungetc(self, ch)
rb_str_modify(ptr->string);
}
RSTRING(ptr->string)->ptr[pos - 1] = cc;
+ OBJ_INFECT(ptr->string, self);
}
--ptr->pos;
}
@@ -783,6 +782,7 @@ strio_write(self, str)
}
rb_str_update(ptr->string, ptr->pos, len, str);
}
+ OBJ_INFECT(ptr->string, self);
ptr->pos += len;
return LONG2NUM(len);
}
@@ -811,6 +811,7 @@ strio_putc(self, ch)
rb_str_modify(ptr->string);
}
RSTRING(ptr->string)->ptr[ptr->pos++] = c;
+ OBJ_INFECT(ptr->string, self);
return ch;
}
@@ -862,7 +863,7 @@ strio_sysread(argc, argv, self)
#define strio_syswrite strio_write
-#define strio_path rb_inspect
+#define strio_path strio_nil
#define strio_isatty strio_false
diff --git a/ruby.c b/ruby.c
index 344007b5a0..2f0dceb697 100644
--- a/ruby.c
+++ b/ruby.c
@@ -429,6 +429,7 @@ proc_options(argc, argv)
char *argv0 = argv[0];
int do_search;
char *s;
+ NODE *volatile script_node = 0;
int version = 0;
int copyright = 0;
@@ -751,6 +752,8 @@ proc_options(argc, argv)
script = dln_find_file(argv[0], getenv(PATH_ENV));
}
if (!script) script = argv[0];
+ script = ruby_sourcefile = rb_source_filename(script);
+ script_node = NEW_NEWLINE(0);
}
#ifdef DOSISH
translate_char(script, '\\', '/');