> From a8da72937ff4d04e8d39531773cc05e676b2be1c Mon Sep 17 00:00:00 2001 > From: Mark H Weaver <m...@netris.org> > Date: Wed, 4 Jan 2012 17:59:27 -0500 > Subject: [PATCH] Fix bugs related to mutation-sharing substrings > > * libguile/strings.c (scm_i_is_narrow_string, scm_i_try_narrow_string, > scm_i_string_set_x): Check to see if the provided string is a > mutation-sharing substring, and do the right thing in that case. > Previously, if such a string was passed to these functions, they would > behave very badly: while trying to fetch and/or mutate the cell > containing the stringbuf, they were actually fetching or mutating the > cell containing original shared string. That's because > mutation-sharing substring store the original string in CELL_1, > whereas all other strings store the stringbuf there.
I committed this. Here's an example that segfaulted before these fixes: scheme@(guile-user)> (define s (string-copy "hello")) scheme@(guile-user)> (define ss (substring/shared s 1 4)) scheme@(guile-user)> (string-set! ss 0 #\λ) Segmentation fault Mark