summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--class.c2
-rw-r--r--eval.c7
-rw-r--r--ext/dbm/dbm.c2
-rw-r--r--ext/md5/md5init.c2
-rw-r--r--numeric.c12
-rw-r--r--ruby.c2
-rw-r--r--ruby.h2
-rw-r--r--string.c6
9 files changed, 34 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 80dbc480d5a..40f87b464a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue Mar 31 13:23:58 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (num2int): raise exception for too big Fixnums on
+ platforms that sizeof(int) < sizeof(INT).
+
+ * string.c (str_center): SEGV on negative width.
+
+ * eval.c (eval): forgot to set sourcefile.
+
Mon Mar 30 11:12:29 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* file.c (f_test): raises exception for unkown command.
diff --git a/class.c b/class.c
index bed83ef7927..41a0b504da2 100644
--- a/class.c
+++ b/class.c
@@ -6,7 +6,7 @@
$Date$
created at: Tue Aug 10 15:05:44 JST 1993
- Copyright (C) 1993-1995 Yukihiro Matsumoto
+ Copyright (C) 1993-1998 Yukihiro Matsumoto
************************************************/
diff --git a/eval.c b/eval.c
index e6872a215eb..95f5d4ad5f7 100644
--- a/eval.c
+++ b/eval.c
@@ -3713,8 +3713,11 @@ eval(self, src, scope, file, line)
file = sourcefile;
line = sourceline;
}
- else if (line > 0) {
- sourceline = line;
+ else {
+ sourcefile = file;
+ if (line > 0) {
+ sourceline = line;
+ }
}
if (!NIL_P(scope)) {
if (TYPE(scope) != T_DATA || RDATA(scope)->dfree != blk_free) {
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index cd630fdb277..cb6a63475ad 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -6,7 +6,7 @@
$Date$
created at: Mon Jan 24 15:59:52 JST 1994
- Copyright (C) 1995 Yukihiro Matsumoto
+ Copyright (C) 1995-1998 Yukihiro Matsumoto
************************************************/
diff --git a/ext/md5/md5init.c b/ext/md5/md5init.c
index 47f913792f1..348f64bcda7 100644
--- a/ext/md5/md5init.c
+++ b/ext/md5/md5init.c
@@ -5,7 +5,7 @@
$Author$
created at: Fri Aug 2 09:24:12 JST 1996
- Copyright (C) 1995 Yukihiro Matsumoto
+ Copyright (C) 1995-1998 Yukihiro Matsumoto
************************************************/
/* This module provides an interface to the RSA Data Security,
diff --git a/numeric.c b/numeric.c
index d07af84425c..527d65d2a33 100644
--- a/numeric.c
+++ b/numeric.c
@@ -588,6 +588,18 @@ num2int(val)
switch (TYPE(val)) {
case T_FIXNUM:
+ if (sizeof(int) < sizeof(INT)) {
+#ifndef INT_MAX
+/* assuming 32bit(2's compliment) int */
+# define INT_MAX 2147483647
+# define INT_MIN (- INT_MAX - 1)
+#endif
+ INT i = FIX2INT(val);
+ if (INT_MIN < i && i < INT_MAX) {
+ return i;
+ }
+ ArgError("Fixnum too big to convert into `int'");
+ }
return FIX2INT(val);
case T_FLOAT:
diff --git a/ruby.c b/ruby.c
index 280c088d717..2c220500dc9 100644
--- a/ruby.c
+++ b/ruby.c
@@ -6,7 +6,7 @@
$Date$
created at: Tue Aug 10 12:47:31 JST 1993
- Copyright (C) 1993-1996 Yukihiro Matsumoto
+ Copyright (C) 1993-1998 Yukihiro Matsumoto
************************************************/
diff --git a/ruby.h b/ruby.h
index ea133413eb9..e6c437369c8 100644
--- a/ruby.h
+++ b/ruby.h
@@ -165,7 +165,7 @@ void rb_check_safe_str _((VALUE));
#define Check_SafeStr(v) rb_check_safe_str((VALUE)(v))
void rb_secure _((int));
-int num2int _((VALUE));
+int num2int _((VALUE));
#define NUM2INT(x) (FIXNUM_P(x)?FIX2INT(x):num2int(x))
double num2dbl _((VALUE));
diff --git a/string.c b/string.c
index 59e4024bbf5..43c8aaac378 100644
--- a/string.c
+++ b/string.c
@@ -2530,7 +2530,7 @@ str_ljust(str, w)
VALUE res;
UCHAR *p, *pend;
- if (RSTRING(str)->len >= width) return str;
+ if (width < 0 || RSTRING(str)->len >= width) return str;
res = str_new(0, width);
memcpy(RSTRING(res)->ptr, RSTRING(str)->ptr, RSTRING(str)->len);
p = RSTRING(res)->ptr + RSTRING(str)->len; pend = RSTRING(res)->ptr + width;
@@ -2549,7 +2549,7 @@ str_rjust(str, w)
VALUE res;
UCHAR *p, *pend;
- if (RSTRING(str)->len >= width) return str;
+ if (width < 0 || RSTRING(str)->len >= width) return str;
res = str_new(0, width);
p = RSTRING(res)->ptr; pend = p + width - RSTRING(str)->len;
while (p < pend) {
@@ -2569,7 +2569,7 @@ str_center(str, w)
UCHAR *p, *pend;
int n;
- if (RSTRING(str)->len >= width) return str;
+ if (width < 0 || RSTRING(str)->len >= width) return str;
res = str_new(0, width);
n = (width - RSTRING(str)->len)/2;
p = RSTRING(res)->ptr; pend = p + n;