This commit is contained in:
Akira TAGOH 2008-05-27 02:36:04 +00:00
parent 67dd6cda0e
commit a4b170df84
9 changed files with 0 additions and 305 deletions

View File

@ -1,26 +0,0 @@
diff -ruN ruby-1.8.4.orig/pack.c ruby-1.8.4/pack.c
--- ruby-1.8.4.orig/pack.c 2005-10-13 23:30:49.000000000 +0900
+++ ruby-1.8.4/pack.c 2006-04-20 13:50:25.000000000 +0900
@@ -347,11 +347,11 @@
return 0; /* not reached */
}
-#if SIZEOF_LONG == SIZE32 || SIZEOF_INT == SIZE32
+#if SIZEOF_LONG == SIZE32
# define EXTEND32(x)
#else
/* invariant in modulo 1<<31 */
-# define EXTEND32(x) do {if (!natint) {(x) = (I32)(((1<<31)-1-(x))^~(~0<<31));}} while(0)
+# define EXTEND32(x) do { if (!natint) {(x) = (((1L<<31)-1-(x))^~(~0L<<31));}} while(0)
#endif
#if SIZEOF_SHORT == SIZE16
# define EXTEND16(x)
@@ -1951,7 +1951,7 @@
case 'w':
{
unsigned long ul = 0;
- unsigned long ulmask = 0xfeL << ((sizeof(unsigned long) - 1) * 8);
+ unsigned long ulmask = 0xfeUL << ((sizeof(unsigned long) - 1UL) * 8UL);
while (len > 0 && s < send) {
ul <<= 7;

View File

@ -1,36 +0,0 @@
diff -ruN ruby-1.8.4.orig/eval.c ruby-1.8.4/eval.c
--- ruby-1.8.4.orig/eval.c 2005-12-20 22:41:47.000000000 +0900
+++ ruby-1.8.4/eval.c 2006-07-20 18:33:50.000000000 +0900
@@ -2097,7 +2097,8 @@
}
}
st_insert(RCLASS(klass)->m_tbl, name,
- (st_data_t)NEW_METHOD(NEW_FBODY(body, def, origin), orig->nd_noex));
+ (st_data_t)NEW_METHOD(NEW_FBODY(body, def, origin),
+ NOEX_WITH_SAFE(orig->nd_noex)));
if (singleton) {
rb_funcall(singleton, singleton_added, 1, ID2SYM(name));
}
@@ -5638,6 +5639,11 @@
TMP_PROTECT;
volatile int safe = -1;
+ if (NOEX_SAFE(flags) > ruby_safe_level &&
+ !(flags&NOEX_TAINTED) && ruby_safe_level == 0 && NOEX_SAFE(flags) > 2) {
+ rb_raise(rb_eSecurityError, "calling insecure method: %s",
+ rb_id2name(id));
+ }
switch (ruby_iter->iter) {
case ITER_PRE:
case ITER_PAS:
@@ -5742,10 +5748,6 @@
b2 = body = body->nd_next;
if (NOEX_SAFE(flags) > ruby_safe_level) {
- if (!(flags&NOEX_TAINTED) && ruby_safe_level == 0 && NOEX_SAFE(flags) > 2) {
- rb_raise(rb_eSecurityError, "calling insecure method: %s",
- rb_id2name(id));
- }
safe = ruby_safe_level;
ruby_safe_level = NOEX_SAFE(flags);
}

View File

@ -1,31 +0,0 @@
diff -ruN ruby-1.8.4.orig/dir.c ruby-1.8.4/dir.c
--- ruby-1.8.4.orig/dir.c 2005-09-14 22:40:58.000000000 +0900
+++ ruby-1.8.4/dir.c 2006-07-19 22:14:05.000000000 +0900
@@ -325,7 +325,17 @@
rb_raise(rb_eIOError, "closed directory");
}
+static void
+dir_check(dir)
+ VALUE dir;
+{
+ if (!OBJ_TAINTED(dir) && rb_safe_level() >= 4)
+ rb_raise(rb_eSecurityError, "Insecure: operation on untainted Dir");
+ rb_check_frozen(dir);
+}
+
#define GetDIR(obj, dirp) do {\
+ dir_check(dir);\
Data_Get_Struct(obj, struct dir_data, dirp);\
if (dirp->dir == NULL) dir_closed();\
} while (0)
@@ -536,6 +546,9 @@
{
struct dir_data *dirp;
+ if (rb_safe_level() >= 4 && !OBJ_TAINTED(dir)) {
+ rb_raise(rb_eSecurityError, "Insecure: can't close");
+ }
GetDIR(dir, dirp);
closedir(dirp->dir);
dirp->dir = NULL;

View File

@ -1,66 +0,0 @@
diff -ruN ruby-1.8.4.orig/re.c ruby-1.8.4/re.c
--- ruby-1.8.4.orig/re.c 2005-12-13 12:27:51.000000000 +0900
+++ ruby-1.8.4/re.c 2006-07-19 18:07:59.000000000 +0900
@@ -70,10 +70,11 @@
#endif
int
-rb_memcicmp(p1, p2, len)
- char *p1, *p2;
+rb_memcicmp(x, y, len)
+ const void *x, *y;
long len;
{
+ const unsigned char *p1 = x, *p2 = y;
int tmp;
while (len--) {
@@ -85,7 +86,7 @@
int
rb_memcmp(p1, p2, len)
- char *p1, *p2;
+ const void *p1, *p2;
long len;
{
if (!ruby_ignorecase) {
@@ -96,11 +97,11 @@
long
rb_memsearch(x0, m, y0, n)
- char *x0, *y0;
+ const void *x0, *y0;
long m, n;
{
- unsigned char *x = (unsigned char *)x0, *y = (unsigned char *)y0;
- unsigned char *s, *e;
+ const unsigned char *x = (unsigned char *)x0, *y = (unsigned char *)y0;
+ const unsigned char *s, *e;
long i;
int d;
unsigned long hx, hy;
@@ -1332,6 +1333,8 @@
{
struct RRegexp *re = RREGEXP(obj);
+ if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)
+ rb_raise(rb_eSecurityError, "Insecure: can't modify regexp");
if (re->ptr) re_free_pattern(re->ptr);
if (re->str) free(re->str);
re->ptr = 0;
diff -ruN ruby-1.8.4.orig/intern.h ruby-1.8.4/intern.h
--- ruby-1.8.4.orig/intern.h 2006-07-19 18:13:49.000000000 +0900
+++ ruby-1.8.4/intern.h 2006-07-19 18:20:34.000000000 +0900
@@ -353,9 +353,9 @@
VALUE rb_range_beg_len _((VALUE, long*, long*, long, int));
VALUE rb_length_by_each _((VALUE));
/* re.c */
-int rb_memcmp _((char*,char*,long));
-int rb_memcicmp _((char*,char*,long));
-long rb_memsearch _((char*,long,char*,long));
+int rb_memcmp _((const void*,const void*,long));
+int rb_memcicmp _((const void*,const void*,long));
+long rb_memsearch _((const void*,long,const void*,long));
VALUE rb_reg_nth_defined _((int, VALUE));
VALUE rb_reg_nth_match _((int, VALUE));
VALUE rb_reg_last_match _((VALUE));

View File

@ -1,56 +0,0 @@
diff -ruN ruby-1.8.4.orig/configure.in ruby-1.8.4/configure.in
--- ruby-1.8.4.orig/configure.in 2005-11-24 21:07:18.000000000 +0900
+++ ruby-1.8.4/configure.in 2006-02-06 12:51:58.000000000 +0900
@@ -437,7 +437,7 @@
AC_REPLACE_FUNCS(dup2 memmove strcasecmp strncasecmp strerror strftime\
strchr strstr strtoul crypt flock vsnprintf\
isnan finite isinf hypot acosh erf)
-AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync getcwd\
+AC_CHECK_FUNCS(fmod killpg wait4 waitpid syscall chroot fsync getcwd eaccess\
truncate chsize times utimes fcntl lockf lstat symlink link\
readlink setitimer setruid seteuid setreuid setresuid\
setproctitle setrgid setegid setregid setresgid issetugid pause\
diff -ruN ruby-1.8.4.orig/file.c ruby-1.8.4/file.c
--- ruby-1.8.4.orig/file.c 2005-12-21 18:20:15.000000000 +0900
+++ ruby-1.8.4/file.c 2006-02-06 12:52:48.000000000 +0900
@@ -849,6 +849,7 @@
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
#endif
+#ifndef HAVE_EACCESS
int
eaccess(path, mode)
const char *path;
@@ -887,6 +888,7 @@
return access(path, mode);
#endif
}
+#endif
/*
diff -ruN ruby-1.8.4.orig/intern.h ruby-1.8.4/intern.h
--- ruby-1.8.4.orig/intern.h 2005-11-23 11:06:00.000000000 +0900
+++ ruby-1.8.4/intern.h 2006-02-06 12:52:54.000000000 +0900
@@ -221,7 +221,6 @@
void rb_thread_atfork _((void));
VALUE rb_funcall_rescue __((VALUE, ID, int, ...));
/* file.c */
-int eaccess _((const char*, int));
VALUE rb_file_s_expand_path _((int, VALUE *));
VALUE rb_file_expand_path _((VALUE, VALUE));
void rb_file_const _((const char*, VALUE));
diff -ruN ruby-1.8.4.orig/missing.h ruby-1.8.4/missing.h
--- ruby-1.8.4.orig/missing.h 2005-06-13 01:58:41.000000000 +0900
+++ ruby-1.8.4/missing.h 2006-02-06 12:53:29.000000000 +0900
@@ -39,6 +39,10 @@
extern int dup2 _((int, int));
#endif
+#ifndef HAVE_EACCESS
+extern int eaccess(const char*, int);
+#endif
+
#ifndef HAVE_FINITE
extern int finite _((double));
#endif

View File

@ -1,48 +0,0 @@
diff -ruN ruby-1.8.5.orig/hash.c ruby-1.8.5/hash.c
--- ruby-1.8.5.orig/hash.c 2006-07-07 00:44:26.000000000 +0900
+++ ruby-1.8.5/hash.c 2006-08-30 15:50:31.000000000 +0900
@@ -223,20 +223,31 @@
rb_ensure(hash_foreach_call, (VALUE)&arg, hash_foreach_ensure, hash);
}
+static VALUE hash_alloc0 _((VALUE));
static VALUE hash_alloc _((VALUE));
static VALUE
-hash_alloc(klass)
+hash_alloc0(klass)
VALUE klass;
{
NEWOBJ(hash, struct RHash);
OBJSETUP(hash, klass, T_HASH);
hash->ifnone = Qnil;
- hash->tbl = st_init_table(&objhash);
return (VALUE)hash;
}
+static VALUE
+hash_alloc(klass)
+ VALUE klass;
+{
+ VALUE hash = hash_alloc0(klass);
+
+ RHASH(hash)->tbl = st_init_table(&objhash);
+
+ return hash;
+}
+
VALUE
rb_hash_new()
{
@@ -325,9 +336,7 @@
int i;
if (argc == 1 && TYPE(argv[0]) == T_HASH) {
- hash = hash_alloc(klass);
-
- RHASH(hash)->ifnone = Qnil;
+ hash = hash_alloc0(klass);
RHASH(hash)->tbl = st_copy(RHASH(argv[0])->tbl);
return hash;

View File

@ -1,11 +0,0 @@
diff -ruN ruby-1.8.4.orig/mkconfig.rb ruby-1.8.4/mkconfig.rb
--- ruby-1.8.4.orig/mkconfig.rb 2006-07-19 20:39:48.000000000 +0900
+++ ruby-1.8.4/mkconfig.rb 2006-07-19 20:40:12.000000000 +0900
@@ -37,6 +37,7 @@
has_version = false
File.foreach "config.status" do |line|
next if /^#/ =~ line
+ line.gsub!(/\|#_!!_#\|/, '')
if /^s[%,]@program_transform_name@[%,]s,(.*)/ =~ line
next if $install_name
ptn = $1.sub(/\$\$/, '$').split(/,/) #'

View File

@ -1,30 +0,0 @@
diff -ruN ruby-1.8.4.orig/ext/tk/extconf.rb ruby-1.8.4/ext/tk/extconf.rb
--- ruby-1.8.4.orig/ext/tk/extconf.rb 2005-11-02 20:28:40.000000000 +0900
+++ ruby-1.8.4/ext/tk/extconf.rb 2005-12-16 19:44:57.000000000 +0900
@@ -48,7 +48,7 @@
stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs")
def find_tcl(tcllib, stubs)
- paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
+ paths = ["/usr/local/lib64", "/usr/local/lib", "/usr/pkg/lib64", "/usr/pkg/lib", "/usr/lib64", "/usr/lib"]
if stubs
func = "Tcl_InitStubs"
lib = "tclstub"
@@ -71,7 +71,7 @@
end
def find_tk(tklib, stubs)
- paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
+ paths = ["/usr/local/lib64", "/usr/local/lib", "/usr/pkg/lib64", "/usr/pkg/lib", "/usr/lib64", "/usr/lib"]
if stubs
func = "Tk_InitStubs"
lib = "tkstub"
@@ -274,7 +274,7 @@
if tcltk_framework ||
(have_header("tcl.h") && have_header("tk.h") &&
(is_win32 || find_library("X11", "XOpenDisplay",
- "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib")) &&
+ "/usr/X11/lib64", "/usr/X11/lib", "/usr/lib64/X11", "/usr/lib/X11", "/usr/X11R6/lib64", "/usr/X11R6/lib", "/usr/openwin/lib64", "/usr/openwin/lib")) &&
find_tcl(tcllib, stubs) &&
find_tk(tklib, stubs))
$CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs

View File

@ -1,6 +1,5 @@
8336b859400795ec51d05878c1a658b7 ruby-man-1.4.6.tar.bz2
d65e3a216d6d345a2a6f1aa8758c2f75 ruby-refm-rdp-1.8.1-ja-html.tar.gz
e1d38b7d4f1be55726d6927a3395ce3b ruby-1.8.6-p111.tar.bz2
634c25b14e19925d10af3720d72e8741 rubyfaq-990927.tar.gz
4fcec898f51d8371cc42d0a013940469 rubyfaq-jp-990927.tar.gz
b4d0c74497f684814bcfbb41b7384a71 ruby-1.8.6-p114.tar.bz2