diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-08-28 06:01:58 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-08-28 06:01:58 +0000 |
commit | 1a44a463af542ca3f5692d1e99cc2a42881c05dc (patch) | |
tree | 54c12c3e0d7dbd3e6cd3faf226555f1e856c9735 | |
parent | c1454b3acbc28ea629b49ea758a1ba43b6fa01ee (diff) | |
download | ruby-1a44a463af542ca3f5692d1e99cc2a42881c05dc.tar.gz |
* string.c (rb_str_delete_bang): should check if str->ptr is 0.
* string.c (rb_str_squeeze_bang): ditto.
* string.c (rb_str_count): ditto.
* string.c (rb_str_lstrip_bang): ditto.
* string.c (rb_str_rstrip_bang): ditto.
* string.c (rb_str_intern): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | configure.in | 3 | ||||
-rw-r--r-- | string.c | 15 | ||||
-rw-r--r-- | version.h | 4 |
4 files changed, 31 insertions, 5 deletions
@@ -1,3 +1,17 @@ +Wed Aug 28 15:00:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org> + + * string.c (rb_str_delete_bang): should check if str->ptr is 0. + + * string.c (rb_str_squeeze_bang): ditto. + + * string.c (rb_str_count): ditto. + + * string.c (rb_str_lstrip_bang): ditto. + + * string.c (rb_str_rstrip_bang): ditto. + + * string.c (rb_str_intern): ditto. + Wed Aug 28 11:37:35 2002 NAKAMURA Usaku <usa@ruby-lang.org> * win32/win32.h: define SIGINT and SIGKILL if not defined. diff --git a/configure.in b/configure.in index fcd77fba3e..f96249ad92 100644 --- a/configure.in +++ b/configure.in @@ -97,7 +97,8 @@ AC_PROG_GCC_TRADITIONAL AC_PROG_YACC AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(AR, ar aal, ar) +AC_CHECK_TOOL(AR, ar) +AC_CHECK_PROGS(AR, ar aal, ar) case "$target_os" in cygwin*|mingw*) @@ -2133,6 +2133,7 @@ tr_trans(str, src, repl, sflag) rb_str_modify(str); StringValue(src); StringValue(repl); + if (RSTRING(str)->len == 0 || !RSTRING(str)->ptr) return Qnil; trsrc.p = RSTRING(src)->ptr; trsrc.pend = trsrc.p + RSTRING(src)->len; if (RSTRING(src)->len >= 2 && RSTRING(src)->ptr[0] == '^') { cflag++; @@ -2288,6 +2289,7 @@ rb_str_delete_bang(argc, argv, str) rb_str_modify(str); s = t = RSTRING(str)->ptr; + if (!s || RSTRING(str)->len == 0) return Qnil; send = s + RSTRING(str)->len; while (s < send) { if (squeez[*s & 0xff]) @@ -2342,8 +2344,8 @@ rb_str_squeeze_bang(argc, argv, str) } rb_str_modify(str); - s = t = RSTRING(str)->ptr; + if (!s || RSTRING(str)->len == 0) return Qnil; send = s + RSTRING(str)->len; save = -1; while (s < send) { @@ -2412,6 +2414,7 @@ rb_str_count(argc, argv, str) } s = RSTRING(str)->ptr; + if (!s || RSTRING(str)->len == 0) return Qnil; send = s + RSTRING(str)->len; i = 0; while (s < send) { @@ -2795,6 +2798,7 @@ rb_str_lstrip_bang(str) rb_str_modify(str); s = RSTRING(str)->ptr; + if (!s || RSTRING(str)->len == 0) return Qnil; e = t = s + RSTRING(str)->len; /* remove spaces at head */ while (s < t && ISSPACE(*s)) s++; @@ -2825,6 +2829,7 @@ rb_str_rstrip_bang(str) rb_str_modify(str); s = RSTRING(str)->ptr; + if (!s || RSTRING(str)->len == 0) return Qnil; e = t = s + RSTRING(str)->len; /* remove trailing spaces */ @@ -2958,12 +2963,15 @@ rb_str_crypt(str, salt) { extern char *crypt(); VALUE result; + char *s; StringValue(salt); if (RSTRING(salt)->len < 2) rb_raise(rb_eArgError, "salt too short(need >=2 bytes)"); - result = rb_str_new2(crypt(RSTRING(str)->ptr, RSTRING(salt)->ptr)); + if (RSTRING(str)->ptr) s = RSTRING(str)->ptr; + else s = ""; + result = rb_str_new2(crypt(s, RSTRING(salt)->ptr)); OBJ_INFECT(result, str); OBJ_INFECT(result, salt); return result; @@ -2975,6 +2983,9 @@ rb_str_intern(str) { ID id; + if (!RSTRING(str)->ptr || RSTRING(str)->len == 0) { + rb_raise(rb_eArgError, "interning empty string"); + } if (strlen(RSTRING(str)->ptr) != RSTRING(str)->len) rb_raise(rb_eArgError, "string contains `\\0'"); id = rb_intern(RSTRING(str)->ptr); @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.7.3" -#define RUBY_RELEASE_DATE "2002-08-27" +#define RUBY_RELEASE_DATE "2002-08-28" #define RUBY_VERSION_CODE 173 -#define RUBY_RELEASE_CODE 20020827 +#define RUBY_RELEASE_CODE 20020828 |