Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix potential protect errors #685

Closed
kevinushey opened this issue Apr 26, 2017 · 1 comment
Closed

fix potential protect errors #685

kevinushey opened this issue Apr 26, 2017 · 1 comment

Comments

@kevinushey
Copy link
Contributor

From https://github.com/kalibera/rprotect:

maacheck

This tool is quite simple and only reports instances of multiple allocating arguments pattern, such as (from Rcpp code):

Rf_lang2(::Rf_install("simpleError"), Rf_mkString(str.c_str()))

This is a real error: Rf_mkString returns an unprotected newly allocated object. Rf_install may allocate and may be called after Rf_mkString, and hence may trigger garbage collection that will corrupt the object allocated by Rf_mkString.

The associated fix needs to occur here:

Rcpp::Shield<SEXP> simpleErrorExpr( Rf_lang2(::Rf_install("simpleError"), Rf_mkString(str.c_str())) );

@eddelbuettel
Copy link
Member

Also see #665

eddelbuettel added a commit that referenced this issue Apr 29, 2017
suggested fix for maacheck (closes #685)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants