From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Aidan Kehoe Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Unicode Lisp reader escapes Date: Mon, 8 May 2006 18:39:08 +0200 Message-ID: <17503.29740.778178.932671@parhasard.net> References: <17491.34779.959316.484740@parhasard.net> <17495.932.70900.796282@parhasard.net> <17495.57895.90438.848865@parhasard.net> <17498.28361.392872.954484@parhasard.net> <17503.21672.395920.94783@parhasard.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1147106389 7724 80.91.229.2 (8 May 2006 16:39:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 8 May 2006 16:39:49 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 08 18:39:45 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fd8lZ-0005sh-8K for ged-emacs-devel@m.gmane.org; Mon, 08 May 2006 18:39:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fd8lY-00040r-Mc for ged-emacs-devel@m.gmane.org; Mon, 08 May 2006 12:39:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fd8lM-0003yo-F6 for emacs-devel@gnu.org; Mon, 08 May 2006 12:39:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fd8lJ-0003u7-SN for emacs-devel@gnu.org; Mon, 08 May 2006 12:39:11 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fd8lJ-0003ty-Me for emacs-devel@gnu.org; Mon, 08 May 2006 12:39:09 -0400 Original-Received: from [66.111.49.30] (helo=icarus.asclepian.ie) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Fd8mB-0001cy-Nd for emacs-devel@gnu.org; Mon, 08 May 2006 12:40:03 -0400 Original-Received: by icarus.asclepian.ie (Postfix, from userid 1003) id E75718008D; Mon, 8 May 2006 17:39:08 +0100 (IST) Original-To: Stefan Monnier In-Reply-To: X-Mailer: VM 7.17 under 21.5 (beta25) "eggplant" (+CVS-20060325) XEmacs Lucid X-Echelon-distraction: Stephanie PLO forschung Fortezza FSK sigvoice X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:54100 Archived-At: Ar an t-ocht=C3=BA l=C3=A1 de m=C3=AD Bealtaine, scr=C3=ADobh Stefan Mon= nier:=20 > >> > In the calling sequence of Fread-> read_internal_start -> read0 -= > > >> > read1, I see no place where the original `tem' is GCPROed. Do I > >> > overlook something? > >>=20 > >> Why would it need to be protected? it's not used afterwards. >=20 > > It can theoretically disappear in the middle of being used. With my = patch, > > if the string consisted of "\u20AC one two", Lisp will be called, th= e > > garbage collector may be invoked, and the string overwritten, since = to the > > GC it=E2=80=99s not in use. Then the READCHAR -> retry loop may end = up reading > > incorrect data.=20 >=20 > That's of not concern to Fcall_interactively. It's Fread should GCPRO= its > argument when needed.=20 Fread is intended to be called from Lisp (it=E2=80=99s a subr). Functions= called from Lisp do not need to GCPRO their arguments, because the garbage collector knows about the arguments, as it knows about all objects alloca= ted in Lisp. C code that calls functions intended to be called from=C2=A0Lisp is optim= istic at best if, without having checked, it relies on the assumption that that th= e arguments to those functions will be GCPROed. > So it seems the bug is that read_internal_start calls > read0 (which can GC) and uses `stream' afterwards without having GCPRO= 'd it. --=20 Aidan Kehoe, http://www.parhasard.net/