Skip to content

Commit 03323bd

Browse files
committed
Dodge some more potential protection issues
1 parent f43dcbf commit 03323bd

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

inst/include/Rcpp/Environment.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ namespace Rcpp{
321321
Armor<SEXP> env ;
322322
try{
323323
SEXP getNamespaceSym = Rf_install("getNamespace");
324-
env = Rcpp_eval( Rf_lang2(getNamespaceSym, Rf_mkString(package.c_str()) ) ) ;
324+
Shield<SEXP> package_str( Rf_mkString(package.c_str()) );
325+
env = Rcpp_eval( Rf_lang2(getNamespaceSym, package_str) ) ;
325326
} catch( ... ){
326327
throw no_such_namespace( package ) ;
327328
}

src/barrier.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ SEXP get_rcpp_cache() {
9393
if( ! Rcpp_cache_know ){
9494

9595
SEXP getNamespaceSym = Rf_install("getNamespace"); // cannot be gc()'ed once in symbol table
96-
Rcpp::Shield<SEXP> RCPP( Rf_eval(Rf_lang2( getNamespaceSym, Rf_mkString("Rcpp") ), R_GlobalEnv) ) ;
96+
Rcpp::Shield<SEXP> RcppString( Rf_mkString("Rcpp") );
97+
Rcpp::Shield<SEXP> RCPP( Rf_eval(Rf_lang2( getNamespaceSym, RcppString ), R_GlobalEnv) ) ;
9798

9899
Rcpp_cache = Rf_findVarInFrame( RCPP, Rf_install(".rcpp_cache") ) ;
99100
Rcpp_cache_know = true ;

0 commit comments

Comments
 (0)