summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-11-10 07:16:52 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-11-10 07:16:52 +0000
commit087c83d7ceed6893afff93066937fb570ae4a115 (patch)
treeb138eb4084c1c032e6eb11d78300976dbc0f6f72
parent13f2744b2e8ac8cc3e727051b2d200fa225a733a (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog12
-rw-r--r--io.c9
-rw-r--r--parse.y4
-rw-r--r--regex.c1
-rw-r--r--rubyio.h4
-rw-r--r--version.h4
6 files changed, 29 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a65ba334a01..a884e91d243 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Fri Nov 10 16:15:53 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): eval("^") caused infinite loop.
+
+Thu Nov 9 14:22:13 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_taint_check): should check IO taintness; no
+ operation for untainted IO should be allowed in the sandbox.
+
+ * rubyio.h (GetOpenFile): check IO taintness inside using
+ rb_io_taint_check().
+
Wed Nov 8 03:08:53 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (io_fflush): ensure fflush(3) would not block by calling
diff --git a/io.c b/io.c
index 626cee7934b..8394f9768b2 100644
--- a/io.c
+++ b/io.c
@@ -143,6 +143,15 @@ rb_eof_error()
rb_raise(rb_eEOFError, "End of file reached");
}
+VALUE
+rb_io_taint_check(io)
+ VALUE io;
+{
+ if (!OBJ_TAINTED(io) && rb_safe_level() >= 4)
+ rb_raise(rb_eSecurityError, "Insecure: operation on untainted IO");
+ return io;
+}
+
void
rb_io_check_closed(fptr)
OpenFile *fptr;
diff --git a/parse.y b/parse.y
index 2e1882626b1..bf391cf8396 100644
--- a/parse.y
+++ b/parse.y
@@ -3280,12 +3280,12 @@ yylex()
case '^':
lex_state = EXPR_BEG;
- if (nextc() == '=') {
+ if ((c = nextc()) == '=') {
yylval.id = '^';
return tOP_ASGN;
}
pushback(c);
- return c;
+ return '^';
case ',':
case ';':
diff --git a/regex.c b/regex.c
index d4c1c2a915a..3287fc32072 100644
--- a/regex.c
+++ b/regex.c
@@ -3766,6 +3766,7 @@ re_match(bufp, string_arg, size, pos, regs)
case start_nowidth:
PUSH_FAILURE_POINT(0, d);
+ printf("%d > %d\n", stackp - stackb, RE_DUP_MAX);
if (stackp - stackb > RE_DUP_MAX) {
FREE_AND_RETURN(stackb,(-2));
}
diff --git a/rubyio.h b/rubyio.h
index 2a3455dbe21..00d55baea10 100644
--- a/rubyio.h
+++ b/rubyio.h
@@ -32,7 +32,7 @@ typedef struct OpenFile {
#define FMODE_BINMODE 4
#define FMODE_SYNC 8
-#define GetOpenFile(obj,fp) rb_io_check_closed((fp) = RFILE(obj)->fptr)
+#define GetOpenFile(obj,fp) rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr)
#define MakeOpenFile(obj, fp) do {\
fp = 0;\
@@ -57,6 +57,8 @@ void rb_io_check_readable _((OpenFile*));
void rb_io_fptr_finalize _((OpenFile*));
void rb_io_synchronized _((OpenFile*));
void rb_io_check_closed _((OpenFile*));
+
+VALUE rb_io_taint_check _((VALUE));
void rb_eof_error _((void));
void rb_read_check _((FILE*));
diff --git a/version.h b/version.h
index 8dd99cfa7e5..6d6ca73556d 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.2"
-#define RUBY_RELEASE_DATE "2000-11-08"
+#define RUBY_RELEASE_DATE "2000-11-10"
#define RUBY_VERSION_CODE 162
-#define RUBY_RELEASE_CODE 20001108
+#define RUBY_RELEASE_CODE 20001110