From: Sam Ruby Date: 2008-01-05T14:05:27+09:00 Subject: Re: String.clone may segfault since rev 14817 Sam Ruby wrote: > + else { > + if (len <= RSTRING_EMBED_LEN_MAX) { > + char *ptr = RSTRING(str)->as.heap.ptr; > + // if (ptr) { > + STR_SET_EMBED(str); > + MEMCPY(RSTRING(str)->as.ary, ptr, char, len); > + RSTRING(str)->as.ary[len] = '\0'; > + STR_SET_EMBED_LEN(str, len); > + xfree(ptr); > + return str; > + // } > + } Whoops! Ignore the double slashes on two of the lines above. :-) Before I sent this to the mailing list, I verified that I got the original segfault if I commented out the if check, and I guess I forgot to restore the code prior to producing the diff. - Sam Ruby