milbo at sonic.net
2009-Jan-03 09:25 UTC
[Rd] Missing PROTECT in intern_getwd (in util.c) (PR#13424)
Full_Name: Stephen Milborrow Version: 2.8.1 OS: WinXP Submission from: (NULL) (198.54.202.150) There is a missing PROTECT in intern_getwd in util.c. The current code is rval = allocVector(STRSXP, 1); SET_STRING_ELT(rval, 0, mkCharCE(buf, CE_UTF8)); and should be (because mkCharCE can allocate memory) PROTECT(rval = allocVector(STRSXP, 1)); SET_STRING_ELT(rval, 0, mkCharCE(buf, CE_UTF8)); UNPROTECT(1); This was seen in R version 2.8.1 mingw32
Prof Brian Ripley
2009-Jan-03 09:58 UTC
[Rd] (PR#13424) Missing PROTECT in intern_getwd (in util.c)
On Sat, 3 Jan 2009, milbo at sonic.net wrote:> Full_Name: Stephen Milborrow > Version: 2.8.1 > OS: WinXP > Submission from: (NULL) (198.54.202.150) > > > There is a missing PROTECT in intern_getwd in util.c. The current code is > > rval = allocVector(STRSXP, 1); > SET_STRING_ELT(rval, 0, mkCharCE(buf, CE_UTF8)); > > and should be (because mkCharCE can allocate memory) > > PROTECT(rval = allocVector(STRSXP, 1)); > SET_STRING_ELT(rval, 0, mkCharCE(buf, CE_UTF8)); > UNPROTECT(1); > > This was seen in R version 2.8.1 mingw32And it is code specific to that platform (although you did not say so). Fixed now in R-patched, thank you. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595