From 58e68a3660c47739d7a70cc6f5cdebec030502d2 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 2 Mar 2000 03:51:50 +0000 Subject: [PATCH] 2000-03-02 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 18 ++++++++++++++++++ config.sub | 4 ++-- eval.c | 2 +- ext/socket/extconf.rb | 4 +++- ext/socket/socket.c | 3 ++- lib/pstore.rb | 4 ++++ lib/singleton.rb | 7 ++++++- lib/weakref.rb | 2 +- object.c | 1 + regex.c | 3 ++- string.c | 3 +++ version.h | 4 ++-- 12 files changed, 45 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index f022c58abb..08061b4571 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +Sat Feb 26 22:39:31 2000 EGUCHI Osamu + + * Fix String#* with huge string. + +Fri Feb 25 06:42:26 2000 GOTOU YUUZOU + + * ext/socket/socket.c (ip_addrsetup): hostp should remain NULL if + host is nil. + +Thu Feb 24 16:53:47 2000 Yukihiro Matsumoto + + * eval.c (rb_thread_schedule): priority was too high for sleep + expired threads. + +Sat Feb 19 23:58:51 2000 Yukihiro Matsumoto + + * regex.c (re_match): pop_loop should not pop at forward jump. + Thu Feb 17 19:09:05 2000 Katsuyuki Komatsu * win32/win32.c (mypopen): don't close handle if it is not assigned. diff --git a/config.sub b/config.sub index f853351cc4..3c591de61b 100644 --- a/config.sub +++ b/config.sub @@ -68,7 +68,7 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - linux-gnu*) + linux*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -891,7 +891,7 @@ case $os in os=-sysv4.2uw ;; -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + os=`echo $os | sed -e 's|gnu/linux|linux|'` ;; # First accept the basic system types. # The portable systems comes first. diff --git a/eval.c b/eval.c index 9c9e0410c4..6ac4d46e60 100644 --- a/eval.c +++ b/eval.c @@ -6517,7 +6517,7 @@ rb_thread_schedule() th->wait_for &= ~WAIT_TIME; th->status = THREAD_RUNNABLE; num_waiting_on_timer--; - next = th; + if (!next) next = th; } else if (th->delay < delay) { delay = th->delay; } diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index b7aee1cc36..6a2937bb3f 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -244,7 +244,9 @@ main() } } - if (inet6 != 2 || inet4 != 2) + if (!(inet4 == 0 || inet4 == 2)) + goto bad; + if (!(inet6 == 0 || inet6 == 2)) goto bad; if (aitop) diff --git a/ext/socket/socket.c b/ext/socket/socket.c index a3ba1925b2..95b2214afb 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -511,6 +511,7 @@ ip_addrsetup(host, port) long i = NUM2LONG(host); mkinetaddr(htonl(i), hbuf, sizeof(hbuf)); + hostp = hbuf; } else { char *name = STR2CSTR(host); @@ -524,8 +525,8 @@ ip_addrsetup(host, port) else { strcpy(hbuf, name); } + hostp = hbuf; } - hostp = hbuf; if (NIL_P(port)) { portp = 0; } diff --git a/lib/pstore.rb b/lib/pstore.rb index 0f37491baf..97b3794326 100644 --- a/lib/pstore.rb +++ b/lib/pstore.rb @@ -52,6 +52,10 @@ class PStore in_transaction @table[name] = value end + def delete(name) + in_transaction + @table.delete name + end def roots in_transaction diff --git a/lib/singleton.rb b/lib/singleton.rb index 4aea574e7a..235ba898fd 100644 --- a/lib/singleton.rb +++ b/lib/singleton.rb @@ -16,8 +16,13 @@ module Singleton klass.instance_eval %{ @__instance__ = nil def instance + Thread.critical = true unless @__instance__ - @__instance__ = new + begin + @__instance__ = new + ensure + Thread.critical = false + end end return @__instance__ end diff --git a/lib/weakref.rb b/lib/weakref.rb index c6fe8cd21b..18b530f2ae 100644 --- a/lib/weakref.rb +++ b/lib/weakref.rb @@ -40,7 +40,7 @@ class WeakRef= 0) break; /* should be backward jump */ p1 += mcnt; - if (p1 >= pend) break; if (( is_a_jump_n && (enum regexpcode)*p1 == succeed_n) || (!is_a_jump_n && (enum regexpcode)*p1 == on_failure_jump)) { if (failed_paren) { diff --git a/string.c b/string.c index 1e51110a96..66eee2a65f 100644 --- a/string.c +++ b/string.c @@ -265,6 +265,9 @@ rb_str_times(str, times) if (len < 0) { rb_raise(rb_eArgError, "negative argument"); } + if (LONG_MAX / len < RSTRING(str)->len) { + rb_raise(rb_eArgError, "argument too big"); + } str2 = rb_str_new(0, RSTRING(str)->len*len); for (i=0; i