In message "[ruby-talk:02008] Re: slice! ate my machine!"
on 00/03/18, ts <decoux / moulon.inra.fr> writes:
|aestivum% ./ruby -e 'a = "hello"; p a.slice!(3, 4); p a'
|"lo"
|"h"
| Perhaps I've not understood what do slice! , but personnaly I'll check
| RSTRING(str)->len < len + beg and adjust len in consequence, no ?
You're right. I should have check more. Here's new patch.
Throw away old one in [ruby-talk:02006](probably by patch -R).
--- string.c.sav Wed Feb 2 08:51:02 2000
+++ string.c Sun Mar 19 01:53:00 2000
@@ -832,2 +888,6 @@
{
+ if (RSTRING(str)->len < beg + len) {
+ len = RSTRING(str)->len - beg;
+ }
+
if (len < RSTRING(val)->len) {