From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: Fixed string corruption bugs (was Guile: What's wrong with this?) Date: Sat, 07 Jan 2012 10:43:57 -0500 Message-ID: <87y5tj8qma.fsf_-_@netris.org> References: <4F027F35.5020001@gmail.com> <1325603029.22166.YahooMailNeo@web37906.mail.mud.yahoo.com> <4F032C41.3070300@gmail.com> <877h17hjj2.fsf@netris.org> <1325687351.71432.YahooMailNeo@web37906.mail.mud.yahoo.com> <874nwbs9c4.fsf@pobox.com> <4F048CBB.9020903@gmail.com> <87k457z5mv.fsf@Kagami.home> <4F04A8AF.9020205@gmail.com> <87aa63f43c.fsf@netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1325951071 28859 80.91.229.12 (7 Jan 2012 15:44:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 7 Jan 2012 15:44:31 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jan 07 16:44:27 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RjYRX-0005pT-1E for guile-devel@m.gmane.org; Sat, 07 Jan 2012 16:44:27 +0100 Original-Received: from localhost ([::1]:56001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjYRW-0005kV-JS for guile-devel@m.gmane.org; Sat, 07 Jan 2012 10:44:26 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:43547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjYRQ-0005kQ-Tc for guile-devel@gnu.org; Sat, 07 Jan 2012 10:44:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RjYRP-0007QY-VT for guile-devel@gnu.org; Sat, 07 Jan 2012 10:44:20 -0500 Original-Received: from world.peace.net ([96.39.62.75]:35270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjYRP-0007QS-Rp for guile-devel@gnu.org; Sat, 07 Jan 2012 10:44:19 -0500 Original-Received: from c-98-216-245-176.hsd1.ma.comcast.net ([98.216.245.176] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1RjYRK-0004cN-JS; Sat, 07 Jan 2012 10:44:14 -0500 In-Reply-To: <87aa63f43c.fsf@netris.org> (Mark H. Weaver's message of "Wed, 04 Jan 2012 18:19:35 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 96.39.62.75 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:13401 Archived-At: > From a8da72937ff4d04e8d39531773cc05e676b2be1c Mon Sep 17 00:00:00 2001 > From: Mark H Weaver > 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 #\=CE=BB) Segmentation fault Mark