summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog39
-rw-r--r--bignum.c13
-rw-r--r--configure4
-rw-r--r--configure.in2
-rw-r--r--eval.c9
-rw-r--r--ext/tk/lib/tk.rb2
-rw-r--r--ext/tk/lib/tkcanvas.rb1
-rw-r--r--file.c80
-rw-r--r--gc.c4
-rw-r--r--hash.c2
-rw-r--r--intern.h2
-rw-r--r--lib/mkmf.rb2
-rw-r--r--numeric.c12
-rw-r--r--object.c1
-rw-r--r--process.c1
-rw-r--r--random.c11
-rw-r--r--range.c1
-rw-r--r--regex.c37
-rw-r--r--regex.h1
-rw-r--r--ruby.c19
-rw-r--r--sprintf.c4
-rw-r--r--string.c8
-rw-r--r--version.h4
23 files changed, 177 insertions, 82 deletions
diff --git a/ChangeLog b/ChangeLog
index cb9a695a89d..8b5efcbea56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+Mon Dec 6 15:55:30 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * numeric.c (fix_rshift): Fix -1 >> 32 returned 0. (-1 is true)
+
+ * numeric.c (fix_rshift): Fix 1 >> -1 returned 0. (2 is true)
+
+Mon Dec 6 11:47:23 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * sprintf.c (rb_f_sprintf): formatted string must be tainted if
+ any of parameters is tainted.
+
+ * file.c (rb_file_s_expand_path): expanded file path need not to
+ be tainted always.
+
+Sun Dec 5 20:25:29 1999 Katsuhiro Ueno <unnie@blue.sky.or.jp>
+
+ * eval.c (Init_Proc): simple typo.
+
+ * gc.c (add_heap): sizeof(RVALUE*), not sizeof(RVALUE).
+
+Sat Dec 4 01:40:22 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_search): adjust startpos for multibyte match unless
+ the first pattern is forced byte match.
+
+ * bignum.c (rb_big_rand): should not use rand/random where drand48
+ may be available. RANDOM_NUMBER should be provided from outside.
+
+Fri Dec 3 09:54:59 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (moreswitches): there may be trailing garbage at #!
+ line.
+
+ * eval.c (rb_f_require): should check require 'feature.o' too.
+
+Thu Dec 2 11:58:15 1999 Koji Arai <JCA02266@nifty.ne.jp>
+
+ * eval.c (rb_thread_loading): should maintain loading_tbl.
+
Thu Dec 2 10:21:43 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* eval.c (rb_thread_loading_done): wrong parameter to st_delete().
diff --git a/bignum.c b/bignum.c
index 05df7c16830..828e0cb9aa5 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1255,20 +1255,17 @@ rb_big_abs(x)
*/
VALUE
-rb_big_rand(max)
+rb_big_rand(max, rand)
VALUE max;
+ double rand;
{
- struct RBignum *v;
+ VALUE v;
long len;
len = RBIGNUM(max)->len;
- v = RBIGNUM(bignew(len,1));
+ v = bignew(len,1);
while (len--) {
-#ifdef HAVE_RANDOM
- BDIGITS(v)[len] = random();
-#else
- BDIGITS(v)[len] = rand();
-#endif
+ BDIGITS(v)[len] = ((USHORT)~0) * rand;
}
return rb_big_mod((VALUE)v, max);
diff --git a/configure b/configure
index 3de072e6b16..fc3575ea036 100644
--- a/configure
+++ b/configure
@@ -3641,7 +3641,7 @@ else
int main() {
/* Ultrix mips cc rejects this. */
-typedef int charset[2]; const charset x;
+typedef int charset[2]; const charset x = {0,0};
/* SunOS 4.1.1 cc rejects this. */
char const *const *ccp;
char **p;
@@ -3783,7 +3783,7 @@ else
int
main()
{
- if (-1==(-1>>1))
+ if (-1==(-1>>(unsigned)1))
return 0;
return 1;
}
diff --git a/configure.in b/configure.in
index 415aae9d236..d046257ae6d 100644
--- a/configure.in
+++ b/configure.in
@@ -260,7 +260,7 @@ AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
int
main()
{
- if (-1==(-1>>1))
+ if (-1==(-1>>(unsigned)1))
return 0;
return 1;
}
diff --git a/eval.c b/eval.c
index 00006aeff54..32d0155b15c 100644
--- a/eval.c
+++ b/eval.c
@@ -3303,6 +3303,7 @@ static VALUE
rb_f_loop()
{
for (;;) { rb_yield_0(Qnil, 0, 0, Qfalse); }
+ return Qnil; /* dummy */
}
static VALUE
@@ -4861,6 +4862,7 @@ rb_f_require(obj, fname)
ext = strrchr(buf, '.');
strcpy(ext, DLEXT);
file = feature = buf;
+ if (rb_provided(feature)) return Qfalse;
}
file = find_file(file);
if (file) goto load_dyna;
@@ -6020,7 +6022,7 @@ Init_Proc()
rb_define_global_function("lambda", rb_f_lambda, 0);
rb_define_global_function("binding", rb_f_binding, 0);
rb_cBinding = rb_define_class("Binding", rb_cObject);
- rb_undef_method(CLASS_OF(rb_cMethod), "new");
+ rb_undef_method(CLASS_OF(rb_cBinding), "new");
rb_define_method(rb_cBinding, "clone", bind_clone, 0);
rb_cMethod = rb_define_class("Method", rb_cObject);
@@ -7361,10 +7363,13 @@ static int
rb_thread_loading(feature)
const char *feature;
{
- if (!rb_provided(feature)) return Qfalse; /* need to load */
if (!loading_tbl) {
loading_tbl = st_init_strtable();
}
+ if (!rb_provided(feature)) {
+ st_insert(loading_tbl, feature, 0);
+ return Qfalse; /* need to load */
+ }
while (st_lookup(loading_tbl, feature, 0)) {
CHECK_INTS;
rb_thread_schedule();
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index f831dbc78ae..c933f9db8b6 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -2131,6 +2131,8 @@ class TkTextWin<TkWindow
end
class TkListbox<TkTextWin
+ include Scrollable
+
WidgetClassNames['Listbox'] = self
def TkListbox.to_eval
'Listbox'
diff --git a/ext/tk/lib/tkcanvas.rb b/ext/tk/lib/tkcanvas.rb
index 40bfa548465..c67bc456ed5 100644
--- a/ext/tk/lib/tkcanvas.rb
+++ b/ext/tk/lib/tkcanvas.rb
@@ -129,6 +129,7 @@ end
class TkCanvas<TkWindow
include TkTreatCItemFont
+ include Scrollable
WidgetClassName = 'Canvas'.freeze
WidgetClassNames[WidgetClassName] = self
diff --git a/file.c b/file.c
index 645a270a73d..f22b742d257 100644
--- a/file.c
+++ b/file.c
@@ -1176,12 +1176,14 @@ rb_file_s_expand_path(argc, argv)
VALUE fname, dname;
char *s, *p;
char buf[MAXPATHLEN+2];
+ int tainted = 0;
rb_scan_args(argc, argv, "11", &fname, &dname);
s = STR2CSTR(fname);
p = buf;
if (s[0] == '~') {
+ tainted = 1;
if (isdirsep(s[1]) || s[1] == '\0') {
char *dir = getenv("HOME");
@@ -1224,9 +1226,11 @@ rb_file_s_expand_path(argc, argv)
else if (!isdirsep(*s)) {
if (argc == 2) {
dname = rb_file_s_expand_path(1, &dname);
+ if (OBJ_TAINTED(dname)) tainted = 1;
strcpy(buf, RSTRING(dname)->ptr);
}
else {
+ tainted = 1;
#ifdef HAVE_GETCWD
getcwd(buf, MAXPATHLEN);
#else
@@ -1286,7 +1290,9 @@ rb_file_s_expand_path(argc, argv)
if (p == buf || !isdirsep(*p)) p++;
*p = '\0';
- return rb_tainted_str_new2(buf);
+ fname = rb_str_new2(buf);
+ if (tainted) OBJ_TAINT(fname);
+ return fname;
}
static int
@@ -1758,18 +1764,18 @@ static VALUE
rb_stat_r(obj)
VALUE obj;
{
- mode_t mode = get_stat(obj)->st_mode;
+ struct stat *st = get_stat(obj);
#ifdef S_IRUSR
if (rb_stat_owned(obj))
- return mode & S_IRUSR ? Qtrue : Qfalse;
+ return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
#endif
#ifdef S_IRGRP
if (rb_stat_grpowned(obj))
- return mode & S_IRGRP ? Qtrue : Qfalse;
+ return st->st_mode & S_IRGRP ? Qtrue : Qfalse;
#endif
#ifdef S_IROTH
- if (!(mode & S_IROTH)) return Qfalse;
+ if (!(st->st_mode & S_IROTH)) return Qfalse;
#endif
return Qtrue;
}
@@ -1778,18 +1784,18 @@ static VALUE
rb_stat_R(obj)
VALUE obj;
{
- mode_t mode = get_stat(obj)->st_mode;
+ struct stat *st = get_stat(obj);
#ifdef S_IRUSR
if (rb_stat_rowned(obj))
- return mode & S_IRUSR ? Qtrue : Qfalse;
+ return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
#endif
#ifdef S_IRGRP
if (group_member(get_stat(obj)->st_gid))
- return mode & S_IRGRP ? Qtrue : Qfalse;
+ return st->st_mode & S_IRGRP ? Qtrue : Qfalse;
#endif
#ifdef S_IROTH
- if (!(mode & S_IROTH)) return Qfalse;
+ if (!(st->st_mode & S_IROTH)) return Qfalse;
#endif
return Qtrue;
}
@@ -1798,18 +1804,18 @@ static VALUE
rb_stat_w(obj)
VALUE obj;
{
- mode_t mode = get_stat(obj)->st_mode;
+ struct stat *st = get_stat(obj);
-#ifdef S_IRUSR
+#ifdef S_IWUSR
if (rb_stat_owned(obj))
- return mode & S_IWUSR ? Qtrue : Qfalse;
+ return st->st_mode & S_IWUSR ? Qtrue : Qfalse;
#endif
-#ifdef S_IRGRP
+#ifdef S_IWGRP
if (rb_stat_grpowned(obj))
- return mode & S_IWGRP ? Qtrue : Qfalse;
+ return st->st_mode & S_IWGRP ? Qtrue : Qfalse;
#endif
-#ifdef S_IROTH
- if (!(mode & S_IWOTH)) return Qfalse;
+#ifdef S_IWOTH
+ if (!(st->st_mode & S_IWOTH)) return Qfalse;
#endif
return Qtrue;
}
@@ -1818,18 +1824,18 @@ static VALUE
rb_stat_W(obj)
VALUE obj;
{
- mode_t mode = get_stat(obj)->st_mode;
+ struct stat *st = get_stat(obj);
-#ifdef S_IRUSR
+#ifdef S_IWUSR
if (rb_stat_rowned(obj))
- return mode & S_IWUSR ? Qtrue : Qfalse;
+ return st->st_mode & S_IWUSR ? Qtrue : Qfalse;
#endif
-#ifdef S_IRGRP
+#ifdef S_IWGRP
if (group_member(get_stat(obj)->st_gid))
- return mode & S_IWGRP ? Qtrue : Qfalse;
+ return st->st_mode & S_IWGRP ? Qtrue : Qfalse;
#endif
-#ifdef S_IROTH
- if (!(mode & S_IWOTH)) return Qfalse;
+#ifdef S_IWOTH
+ if (!(st->st_mode & S_IWOTH)) return Qfalse;
#endif
return Qtrue;
}
@@ -1838,18 +1844,18 @@ static VALUE
rb_stat_x(obj)
VALUE obj;
{
- mode_t mode = get_stat(obj)->st_mode;
+ struct stat *st = get_stat(obj);
-#ifdef S_IRUSR
+#ifdef S_IXUSR
if (rb_stat_owned(obj))
- return mode & S_IXUSR ? Qtrue : Qfalse;
+ return st->st_mode & S_IXUSR ? Qtrue : Qfalse;
#endif
-#ifdef S_IRGRP
+#ifdef S_IXGRP
if (rb_stat_grpowned(obj))
- return mode & S_IXGRP ? Qtrue : Qfalse;
+ return st->st_mode & S_IXGRP ? Qtrue : Qfalse;
#endif
-#ifdef S_IROTH
- if (!(mode & S_IXOTH)) return Qfalse;
+#ifdef S_IXOTH
+ if (!(st->st_mode & S_IXOTH)) return Qfalse;
#endif
return Qtrue;
}
@@ -1858,18 +1864,18 @@ static VALUE
rb_stat_X(obj)
VALUE obj;
{
- mode_t mode = get_stat(obj)->st_mode;
+ struct stat *st = get_stat(obj);
-#ifdef S_IRUSR
+#ifdef S_IXUSR
if (rb_stat_rowned(obj))
- return mode & S_IXUSR ? Qtrue : Qfalse;
+ return st->st_mode & S_IXUSR ? Qtrue : Qfalse;
#endif
-#ifdef S_IRGRP
+#ifdef S_IXGRP
if (group_member(get_stat(obj)->st_gid))
- return mode & S_IXGRP ? Qtrue : Qfalse;
+ return st->st_mode & S_IXGRP ? Qtrue : Qfalse;
#endif
-#ifdef S_IROTH
- if (!(mode & S_IXOTH)) return Qfalse;
+#ifdef S_IXOTH
+ if (!(st->st_mode & S_IXOTH)) return Qfalse;
#endif
return Qtrue;
}
diff --git a/gc.c b/gc.c
index 0398b6b946e..61227241759 100644
--- a/gc.c
+++ b/gc.c
@@ -242,8 +242,8 @@ add_heap()
/* Realloc heaps */
heaps_length += HEAPS_INCREMENT;
heaps = (heaps_used>0)?
- (RVALUE**)realloc(heaps, heaps_length*sizeof(RVALUE)):
- (RVALUE**)malloc(heaps_length*sizeof(RVALUE));
+ (RVALUE**)realloc(heaps, heaps_length*sizeof(RVALUE*)):
+ (RVALUE**)malloc(heaps_length*sizeof(RVALUE*));
if (heaps == 0) rb_fatal("can't alloc memory");
}
diff --git a/hash.c b/hash.c
index 10e9f863465..fed5b9e7ec4 100644
--- a/hash.c
+++ b/hash.c
@@ -895,7 +895,7 @@ env_delete(obj, name)
if (strcmp(nam, "PATH") == 0 && !OBJ_TAINTED(name)) {
path_tainted = 0;
}
- return rb_str_new2(val);
+ return rb_tainted_str_new2(val);
}
return Qnil;
}
diff --git a/intern.h b/intern.h
index 963571360fd..95f3ad517f2 100644
--- a/intern.h
+++ b/intern.h
@@ -57,7 +57,7 @@ VALUE rb_big_and _((VALUE, VALUE));
VALUE rb_big_or _((VALUE, VALUE));
VALUE rb_big_xor _((VALUE, VALUE));
VALUE rb_big_lshift _((VALUE, VALUE));
-VALUE rb_big_rand _((VALUE));
+VALUE rb_big_rand _((VALUE, double));
/* class.c */
VALUE rb_class_new _((VALUE));
VALUE rb_singleton_class_new _((VALUE));
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 5df77bd3ab3..e77c45871ec 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -4,7 +4,7 @@
require 'rbconfig'
require 'find'
-include Config
+CONFIG = Config::MAKEFILE_CONFIG
SRC_EXT = ["c", "cc", "m", "cxx", "cpp", "C"]
diff --git a/numeric.c b/numeric.c
index d1c016e708f..77b52ffec96 100644
--- a/numeric.c
+++ b/numeric.c
@@ -63,6 +63,7 @@ coerce_rescue(x)
STR2CSTR(rb_inspect(x[1])):
rb_class2name(CLASS_OF(x[1])),
rb_class2name(CLASS_OF(x[0])));
+ return Qnil; /* dummy */
}
static void
@@ -657,6 +658,7 @@ fail_to_integer(val)
{
rb_raise(rb_eTypeError, "failed to convert %s into Integer",
rb_class2name(CLASS_OF(val)));
+ return Qnil; /* dummy */
}
long
@@ -1169,12 +1171,10 @@ fix_rshift(x, y)
long i, val;
i = NUM2LONG(y);
- if (i < sizeof(long) * 8) {
- val = RSHIFT(FIX2LONG(x), i);
- return INT2FIX(val);
- }
-
- return INT2FIX(0);
+ if (i < 0)
+ return fix_lshift(x, INT2FIX(-i));
+ val = RSHIFT(FIX2LONG(x), i);
+ return INT2FIX(val);
}
static VALUE
diff --git a/object.c b/object.c
index 6314974e3f0..be070a9ac21 100644
--- a/object.c
+++ b/object.c
@@ -598,6 +598,7 @@ static VALUE
rb_class_s_inherited()
{
rb_raise(rb_eTypeError, "can't make subclass of Class");
+ return Qnil; /* dummy */
}
static VALUE
diff --git a/process.c b/process.c
index 211445b88de..cecdaa67702 100644
--- a/process.c
+++ b/process.c
@@ -505,6 +505,7 @@ rb_f_exec(argc, argv)
proc_exec_n(argc, argv, prog);
}
rb_sys_fail(RSTRING(argv[0])->ptr);
+ return Qnil; /* dummy */
}
static VALUE
diff --git a/random.c b/random.c
index fbfa94e4e98..67c752d0f79 100644
--- a/random.c
+++ b/random.c
@@ -126,13 +126,12 @@ rb_f_rand(obj, vmax)
long val, max;
switch (TYPE(vmax)) {
- case T_BIGNUM:
- return rb_big_rand(vmax);
-
case T_FLOAT:
- if (RFLOAT(vmax)->value > LONG_MAX || RFLOAT(vmax)->value < LONG_MIN)
- return rb_big_rand(rb_dbl2big(RFLOAT(vmax)->value));
- break;
+ if (RFLOAT(vmax)->value <= LONG_MAX && RFLOAT(vmax)->value >= LONG_MIN)
+ break;
+ /* fall through */
+ case T_BIGNUM:
+ return rb_big_rand(vmax, RANDOM_NUMBER);
}
max = NUM2LONG(vmax);
diff --git a/range.c b/range.c
index b1925e99291..f521c1405d2 100644
--- a/range.c
+++ b/range.c
@@ -30,6 +30,7 @@ static VALUE
range_failed()
{
rb_raise(rb_eArgError, "bad value for range");
+ return Qnil; /* dummy */
}
static VALUE
diff --git a/regex.c b/regex.c
index f77d635a0a4..834d97b574a 100644
--- a/regex.c
+++ b/regex.c
@@ -396,6 +396,7 @@ re_set_syntax(syntax)
long syntax;
{
/* obsolete */
+ return 0;
}
@@ -2272,9 +2273,9 @@ re_compile_pattern(pattern, size, bufp)
}
if (!(bufp->options & RE_OPTIMIZE_NO_BM)) {
bufp->must_skip = (int *) xmalloc((1 << BYTEWIDTH)*sizeof(int));
- bm_init_skip(bufp->must_skip, bufp->must+1,
+ bm_init_skip(bufp->must_skip, (unsigned char*)bufp->must+1,
(unsigned char)bufp->must[0],
- MAY_TRANSLATE()?translate:0);
+ (unsigned char*)(MAY_TRANSLATE()?translate:0));
}
}
@@ -2626,6 +2627,7 @@ re_compile_fastmap(bufp)
fastmap[translate[p[2]]] = 2;
else
fastmap[p[2]] = 2;
+ bufp->options |= RE_OPTIMIZE_BMATCH;
}
else if (TRANSLATE_P())
fastmap[translate[p[1]]] = 1;
@@ -2828,8 +2830,10 @@ re_compile_fastmap(bufp)
while (beg <= end) {
/* NOTE: Charset for multi-byte chars might contain
single-byte chars. We must reject them. */
- if (c < 0x100)
+ if (c < 0x100) {
fastmap[beg] = 2;
+ bufp->options |= RE_OPTIMIZE_BMATCH;
+ }
else if (ismbchar(beg))
fastmap[beg] = 1;
beg++;
@@ -2950,6 +2954,33 @@ re_search(bufp, string, size, startpos, range, regs)
re_compile_fastmap(bufp);
}
+ /* Adjust startpos for mbc string */
+ if (current_mbctype && startpos>0 && !(bufp->options&RE_OPTIMIZE_BMATCH)) {
+ int i = 0;
+
+ if (range > 0) {
+ while (i<size) {
+ i += mbclen(string[i]);
+ if (startpos <= i) {
+ startpos = i;
+ break;
+ }
+ }
+ }
+ else {
+ int w;
+
+ while (i<size) {
+ w = mbclen(string[i]);
+ if (startpos < i + w) {
+ startpos = i;
+ break;
+ }
+ i += w;
+ }
+ }
+ }
+
/* If the search isn't to be a backwards one, don't waste time in a
search for a pattern that must be anchored. */
if (bufp->used>0) {
diff --git a/regex.h b/regex.h
index 8ce80d472bc..0d912732417 100644
--- a/regex.h
+++ b/regex.h
@@ -77,6 +77,7 @@
#define RE_OPTIMIZE_ANCHOR (RE_MAY_IGNORECASE<<1)
#define RE_OPTIMIZE_EXACTN (RE_OPTIMIZE_ANCHOR<<1)
#define RE_OPTIMIZE_NO_BM (RE_OPTIMIZE_EXACTN<<1)
+#define RE_OPTIMIZE_BMATCH (RE_OPTIMIZE_NO_BM<<1)
/* For multi-byte char support */
#define MBCTYPE_ASCII 0
diff --git a/ruby.c b/ruby.c
index 19879859fc7..b5c632b4e39 100644
--- a/ruby.c
+++ b/ruby.c
@@ -289,6 +289,7 @@ process_sflag()
rb_ary_shift(rb_argv);
}
}
+ sflag = 0;
}
static void proc_options _((int argc, char **argv));
@@ -303,8 +304,10 @@ moreswitches(s)
argc = 2; argv[0] = argv[2] = 0;
while (*s && !ISSPACE(*s))
s++;
- argv[1] = ALLOCA_N(char, s - p + 2);
- sprintf(argv[1], "-%s", p);
+ argv[1] = ALLOCA_N(char, s-p+2);
+ argv[1][0] = '-';
+ strncpy(argv[1]+1, p, s-p);
+ argv[1][s-p+1] = '\0';
proc_options(argc, argv);
while (*s && ISSPACE(*s))
s++;
@@ -450,13 +453,16 @@ proc_options(argc, argv)
break;
case 'F':
- rb_fs = rb_str_new2(s+1);
+ if (*++s) {
+ rb_fs = rb_str_new2(s);
+ }
break;
case 'K':
- s++;
- rb_set_kcode(s);
- s++;
+ if (*++s) {
+ rb_set_kcode(s);
+ s++;
+ }
goto reswitch;
case 'T':
@@ -634,7 +640,6 @@ proc_options(argc, argv)
}
process_sflag();
- sflag = 0;
xflag = 0;
}
diff --git a/sprintf.c b/sprintf.c
index 5bfd4031815..5badb61f715 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -172,10 +172,12 @@ rb_f_sprintf(argc, argv)
int width, prec, flags = FNONE;
int nextarg = 0;
+ int tainted = 0;
VALUE tmp;
VALUE str;
fmt = GETARG();
+ if (OBJ_TAINTED(fmt)) tainted = 1;
p = str2cstr(fmt, &blen);
end = p + blen;
blen = 0;
@@ -318,6 +320,7 @@ rb_f_sprintf(argc, argv)
int len;
str = rb_obj_as_string(arg);
+ if (OBJ_TAINTED(str)) tainted = 1;
len = RSTRING(str)->len;
if (flags&FPREC) {
if (prec < len) {
@@ -651,6 +654,7 @@ rb_f_sprintf(argc, argv)
result = rb_str_new(buf, blen);
free(buf);
+ if (tainted) OBJ_TAINT(result);
return result;
}
diff --git a/string.c b/string.c
index 7b8c558c110..ee22f202e44 100644
--- a/string.c
+++ b/string.c
@@ -128,7 +128,7 @@ rb_str_to_str(str)
}
static void
-rb_str_assign(str, str2)
+rb_str_become(str, str2)
VALUE str, str2;
{
if (str == str2) return;
@@ -422,7 +422,9 @@ rb_str_concat(str1, str2)
}
}
if (TYPE(str2) != T_STRING) str2 = rb_str_to_str(str2);
- return rb_str_cat(str1, RSTRING(str2)->ptr, RSTRING(str2)->len);
+ str1 = rb_str_cat(str1, RSTRING(str2)->ptr, RSTRING(str2)->len);
+ if (OBJ_TAINTED(str2)) OBJ_TAINT(str1);
+ return str1;
}
int
@@ -746,7 +748,7 @@ rb_str_succ_bang(str)
VALUE str;
{
rb_str_modify(str);
- rb_str_assign(str, rb_str_succ(str));
+ rb_str_become(str, rb_str_succ(str));
return str;
}
diff --git a/version.h b/version.h
index 6baa2657809..508325f620d 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.0"
-#define RUBY_RELEASE_DATE "1999-12-02"
+#define RUBY_RELEASE_DATE "1999-12-06"
#define RUBY_VERSION_CODE 150
-#define RUBY_RELEASE_CODE 19991202
+#define RUBY_RELEASE_CODE 19991206