From P.Dalgaard at biostat.ku.dk  Mon Jan 14 19:18:47 2008
From: P.Dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Mon, 14 Jan 2008 19:18:47 +0100
Subject: [Rd] %s in filename when opening device causes crash (PR#10571)
In-Reply-To: <20080114175023.B5B242834612@mail.pubhealth.ku.dk>
References: <20080114175023.B5B242834612@mail.pubhealth.ku.dk>
Message-ID: <478BA787.8060806@biostat.ku.dk>

ripley at stats.ox.ac.uk wrote:
> On Mon, 14 Jan 2008, richard.cotton at hsl.gov.uk wrote:
>
>   
>> Full_Name: Richard Cotton
>> Version: 2.6.1
>> OS: Windows XP (32bit)
>> Submission from: (NULL) (193.119.236.82)
>>
>>
>> Using %s in a filename when opening a device causes R to crash, e.g.,
>>
>> pdf("foo%s.pdf")
>> win.metafile("foo%s.wmf")
>> postscript("foo%s.ps")
>>     
>
> Do you have a workaround for this?  Since that is done at C level, we 
> can't easily trap this (especially on Windows), and the list of possible 
> errors that might cause a crash is rather long.
>
> It has been considered as a vulnerability, but there seems no simple 
> solution.
>
>   
Yes. The problem is of course that we do want a sprintf() format there
for "Rplot%03d.pdf" et al. One  option would be to escape "%" except
when in (regexp) "%[0-9]*d", which seems nontrivial, but not impossible.

-- 
   O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



[Rd] %s in filename when opening device causes crash (PR#10571)
Peter Dalgaard