diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-30 11:35:08 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-30 11:35:08 +0000 |
commit | ebc1bf7b116c83a8b797e02949fbbad2797d365a (patch) | |
tree | 456c686263e1000c3b646cc8c9e04be61e625685 | |
parent | 9ab65a1a75abbb38f421052a3c4dcb763bf039fd (diff) | |
download | ruby-ebc1bf7b116c83a8b797e02949fbbad2797d365a.tar.gz ruby-ebc1bf7b116c83a8b797e02949fbbad2797d365a.tar.xz ruby-ebc1bf7b116c83a8b797e02949fbbad2797d365a.zip |
merge revision(s) 17530:
* string.c (str_buf_cat): check for self concatenation.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_6@17733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | string.c | 9 | ||||
-rw-r--r-- | version.h | 8 |
3 files changed, 16 insertions, 5 deletions
@@ -1,3 +1,7 @@ +Mon Jun 30 20:34:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * string.c (str_buf_cat): check for self concatenation. + Sun Jun 29 21:38:52 2008 Tanaka Akira <akr@fsij.org> * eval.c (rb_obj_respond_to): use RTEST to test the result of @@ -693,9 +693,13 @@ str_buf_cat(str, ptr, len) const char *ptr; long len; { - long capa, total; + long capa, total, off = -1;; rb_str_modify(str); + if (ptr >= RSTRING(str)->ptr && ptr <= RSTRING(str)->ptr + RSTRING(str)->len) { + off = ptr - RSTRING(str)->ptr; + } + if (len == 0) return 0; if (FL_TEST(str, STR_ASSOC)) { FL_UNSET(str, STR_ASSOC); capa = RSTRING(str)->aux.capa = RSTRING(str)->len; @@ -717,6 +721,9 @@ str_buf_cat(str, ptr, len) } RESIZE_CAPA(str, capa); } + if (off != -1) { + ptr = RSTRING(str)->ptr + off; + } memcpy(RSTRING(str)->ptr + RSTRING(str)->len, ptr, len); RSTRING(str)->len = total; RSTRING(str)->ptr[total] = '\0'; /* sentinel */ @@ -1,15 +1,15 @@ #define RUBY_VERSION "1.8.6" -#define RUBY_RELEASE_DATE "2008-06-29" +#define RUBY_RELEASE_DATE "2008-06-30" #define RUBY_VERSION_CODE 186 -#define RUBY_RELEASE_CODE 20080629 -#define RUBY_PATCHLEVEL 255 +#define RUBY_RELEASE_CODE 20080630 +#define RUBY_PATCHLEVEL 256 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 #define RUBY_VERSION_TEENY 6 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 29 +#define RUBY_RELEASE_DAY 30 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; |