aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-30 00:35:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-30 00:35:28 +0000
commita5031810492e168e0a834521112f42777d431506 (patch)
tree4da7d18d9e8e2f21a7582c96c8bb983956678586
parent5eaf7e581661ea92c0468eb239ece86b27187ade (diff)
downloadruby-a5031810492e168e0a834521112f42777d431506.tar.gz
* string.c (rb_str_update): get rid of SEGV at just allocated String.
[ruby-core:01812] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--string.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 941f7a111b..c7143225d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Nov 30 09:35:14 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_update): get rid of SEGV at just allocated String.
+ [ruby-core:01812]
+
Fri Nov 28 23:19:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (gc_mark): explicitly check mark recursion levels, instead
diff --git a/string.c b/string.c
index eebc61cd10..d0ccce7671 100644
--- a/string.c
+++ b/string.c
@@ -1314,7 +1314,9 @@ rb_str_update(str, beg, len, val)
memmove(RSTRING(str)->ptr+beg, RSTRING(val)->ptr, RSTRING(val)->len);
}
RSTRING(str)->len += RSTRING(val)->len - len;
- RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
+ if (RSTRING(str)->ptr) {
+ RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
+ }
OBJ_INFECT(str, val);
}