Skip to content

Commit 47dfdac

Browse files
committed
merge revision(s) 17530:
* string.c (str_buf_cat): check for self concatenation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@17733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 904a268 commit 47dfdac

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Mon Jun 30 20:34:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* string.c (str_buf_cat): check for self concatenation.
4+
15
Sun Jun 29 21:38:52 2008 Tanaka Akira <akr@fsij.org>
26

37
* eval.c (rb_obj_respond_to): use RTEST to test the result of

string.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,9 +693,13 @@ str_buf_cat(str, ptr, len)
693693
const char *ptr;
694694
long len;
695695
{
696-
long capa, total;
696+
long capa, total, off = -1;;
697697

698698
rb_str_modify(str);
699+
if (ptr >= RSTRING(str)->ptr && ptr <= RSTRING(str)->ptr + RSTRING(str)->len) {
700+
off = ptr - RSTRING(str)->ptr;
701+
}
702+
if (len == 0) return 0;
699703
if (FL_TEST(str, STR_ASSOC)) {
700704
FL_UNSET(str, STR_ASSOC);
701705
capa = RSTRING(str)->aux.capa = RSTRING(str)->len;
@@ -717,6 +721,9 @@ str_buf_cat(str, ptr, len)
717721
}
718722
RESIZE_CAPA(str, capa);
719723
}
724+
if (off != -1) {
725+
ptr = RSTRING(str)->ptr + off;
726+
}
720727
memcpy(RSTRING(str)->ptr + RSTRING(str)->len, ptr, len);
721728
RSTRING(str)->len = total;
722729
RSTRING(str)->ptr[total] = '\0'; /* sentinel */

version.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#define RUBY_VERSION "1.8.6"
2-
#define RUBY_RELEASE_DATE "2008-06-29"
2+
#define RUBY_RELEASE_DATE "2008-06-30"
33
#define RUBY_VERSION_CODE 186
4-
#define RUBY_RELEASE_CODE 20080629
5-
#define RUBY_PATCHLEVEL 255
4+
#define RUBY_RELEASE_CODE 20080630
5+
#define RUBY_PATCHLEVEL 256
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8
99
#define RUBY_VERSION_TEENY 6
1010
#define RUBY_RELEASE_YEAR 2008
1111
#define RUBY_RELEASE_MONTH 6
12-
#define RUBY_RELEASE_DAY 29
12+
#define RUBY_RELEASE_DAY 30
1313

1414
#ifdef RUBY_EXTERN
1515
RUBY_EXTERN const char ruby_version[];

0 commit comments

Comments
 (0)