From f2ed04ff646a0d91528232a559841a9b0d0f00c3 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Sat, 2 Nov 2019 14:57:01 -0500 Subject: [PATCH 1/3] protect Rf_mkString inside Rf_lang2 --- ChangeLog | 1 + inst/include/Rcpp/Reference.h | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a38eac8be..0b20a4ec5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ * DESCRIPTION (Version, Date): Roll minor version + * inst/include/Rcpp/Reference.h: Shield Rf_mkstring inside Rf_lang2 2019-10-31 Romain Francois * inst/include/Rcpp/DataFrame.h: Protect temporaries from gc diff --git a/inst/include/Rcpp/Reference.h b/inst/include/Rcpp/Reference.h index 55f99e7f2..4bd08276f 100644 --- a/inst/include/Rcpp/Reference.h +++ b/inst/include/Rcpp/Reference.h @@ -2,7 +2,7 @@ // // Reference.h: Rcpp R/C++ interface class library -- Reference class objects // -// Copyright (C) 2010 - 2015 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2019 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -58,7 +58,8 @@ namespace Rcpp{ */ Reference_Impl( const std::string& klass ) { SEXP newSym = Rf_install("new"); - Shield call( Rf_lang2( newSym, Rf_mkString( klass.c_str() ) ) ); + Shield str(Rf_mkString(klass.c_str())); + Shield call(Rf_lang2(newSym, str)); Storage::set__( Rcpp_fast_eval( call , Rcpp::internal::get_Rcpp_namespace()) ); } From dd7b0d23df22cf3b298e8842006d962d200abfcf Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Sat, 2 Nov 2019 15:14:11 -0500 Subject: [PATCH 2/3] protect Rf_mkString inside Rf_lang2 --- ChangeLog | 1 + inst/include/Rcpp/Environment.h | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b20a4ec5..a6740d479 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ * DESCRIPTION (Version, Date): Roll minor version * inst/include/Rcpp/Reference.h: Shield Rf_mkstring inside Rf_lang2 + * inst/include/Rcpp/Environment.h: Idem (inside Rf_lang4) 2019-10-31 Romain Francois * inst/include/Rcpp/DataFrame.h: Protect temporaries from gc diff --git a/inst/include/Rcpp/Environment.h b/inst/include/Rcpp/Environment.h index ddfbcde67..636ab8d38 100644 --- a/inst/include/Rcpp/Environment.h +++ b/inst/include/Rcpp/Environment.h @@ -2,8 +2,8 @@ // // Environment.h: Rcpp R/C++ interface class library -- access R environments // -// Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois -// Copyright (C) 2014 Dirk Eddelbuettel, Romain Francois and Kevin Ushey +// Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2014 - 2019 Dirk Eddelbuettel, Romain Francois and Kevin Ushey // // This file is part of Rcpp. // @@ -246,9 +246,8 @@ namespace Rcpp{ we have to go back to R to do this operation */ SEXP internalSym = Rf_install( ".Internal" ); SEXP removeSym = Rf_install( "remove" ); - Shield call( Rf_lang2(internalSym, - Rf_lang4(removeSym, Rf_mkString(name.c_str()), Storage::get__(), Rf_ScalarLogical( FALSE )) - ) ); + Shield str(Rf_mkString(name.c_str())); + Shield call(Rf_lang2(internalSym, Rf_lang4(removeSym, str, Storage::get__(), Rf_ScalarLogical(FALSE)))); Rcpp_fast_eval( call, R_GlobalEnv ) ; } } else{ From da4b7057b8b5eaad777085d585963b73f0441568 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Sat, 2 Nov 2019 15:16:38 -0500 Subject: [PATCH 3/3] protect Rf_mkString inside Rf_lang3 and Rf_lang4 --- ChangeLog | 2 ++ inst/include/Rcpp/proxy/FieldProxy.h | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6740d479..5605adb78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ * inst/include/Rcpp/Reference.h: Shield Rf_mkstring inside Rf_lang2 * inst/include/Rcpp/Environment.h: Idem (inside Rf_lang4) + * inst/include/Rcpp/proxy/FieldProxy.h: Idem (inside Rf_lang3 and 4) + 2019-10-31 Romain Francois * inst/include/Rcpp/DataFrame.h: Protect temporaries from gc diff --git a/inst/include/Rcpp/proxy/FieldProxy.h b/inst/include/Rcpp/proxy/FieldProxy.h index 768705188..f0a0fb50e 100644 --- a/inst/include/Rcpp/proxy/FieldProxy.h +++ b/inst/include/Rcpp/proxy/FieldProxy.h @@ -41,12 +41,14 @@ class FieldProxyPolicy { const std::string& field_name ; SEXP get() const { - Shield call( Rf_lang3( R_DollarSymbol, parent, Rf_mkString(field_name.c_str()) ) ) ; + Shield str(Rf_mkString(field_name.c_str())); + Shield call(Rf_lang3(R_DollarSymbol, parent, str)); return Rcpp_fast_eval( call, R_GlobalEnv ) ; } void set(SEXP x ) { SEXP dollarGetsSym = Rf_install( "$<-"); - Shield call( Rf_lang4( dollarGetsSym, parent, Rf_mkString(field_name.c_str()) , x ) ) ; + Shield str(Rf_mkString(field_name.c_str())); + Shield call(Rf_lang4(dollarGetsSym, parent, str, x)); parent.set__( Rcpp_fast_eval( call, R_GlobalEnv ) ); } } ; @@ -66,7 +68,8 @@ class FieldProxyPolicy { const std::string& field_name ; SEXP get() const { - Shield call( Rf_lang3( R_DollarSymbol, parent, Rf_mkString(field_name.c_str()) ) ) ; + Shield str(Rf_mkString(field_name.c_str())); + Shield call(Rf_lang3(R_DollarSymbol, parent, str)); return Rcpp_fast_eval( call, R_GlobalEnv ) ; } } ;