diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | string.c | 4 |
2 files changed, 8 insertions, 1 deletions
@@ -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 @@ -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); } |