>>>>> "Y" == Yukihiro Matsumoto <matz / netlab.co.jp> writes: Y> - if (len != RSTRING(val)->len) { Y> + if (RSTRING(val)->len != len && RSTRING(val)->len > beg + len) { Y> memmove(RSTRING(str)->ptr + beg + RSTRING(val)->len, aestivum% diff -u string.c.old string.c --- string.c.old Sat Mar 18 17:18:46 2000 +++ string.c Sat Mar 18 17:19:48 2000 @@ -891,7 +891,7 @@ REALLOC_N(RSTRING(str)->ptr, char, RSTRING(str)->len+RSTRING(val)->len-len+1); } - if (len != RSTRING(val)->len) { + if (RSTRING(val)->len != len && RSTRING(val)->len > beg + len) { memmove(RSTRING(str)->ptr + beg + RSTRING(val)->len, RSTRING(str)->ptr + beg + len, RSTRING(str)->len - (beg + len)); aestivum% ./ruby -e 'a = "hello"; p a.slice!(3, 4); p a' "lo" "h" aestivum% ruby -v ruby 1.5.3 (2000-03-17) [i686-linux] aestivum% Perhaps I've not understood what do slice! , but personnaly I'll check RSTRING(str)->len < len + beg and adjust len in consequence, no ? Guy Decoux