emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Unicode Lisp reader escapes


From: Aidan Kehoe
Subject: Re: [PATCH] Unicode Lisp reader escapes
Date: Mon, 8 May 2006 18:39:08 +0200

 Ar an t-ochtú lá de mí Bealtaine, scríobh Stefan Monnier: 

 > >> > 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?
 > >> 
 > >> Why would it need to be protected? it's not used afterwards.
 > 
 > > 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, the
 > > garbage collector may be invoked, and the string overwritten, since to the
 > > GC it’s not in use. Then the READCHAR -> retry loop may end up reading
 > > incorrect data. 
 > 
 > That's of not concern to Fcall_interactively.  It's Fread should GCPRO its
 > argument when needed. 

Fread is intended to be called from Lisp (it’s 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 allocated
in Lisp.

C code that calls functions intended to be called from Lisp is optimistic at
best if, without having checked, it relies on the assumption that that the
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.

-- 
Aidan Kehoe, http://www.parhasard.net/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]