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

Comments

Projects
None yet
2 participants
@kevinushey
Contributor

kevinushey commented Apr 26, 2017

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

This comment has been minimized.

Show comment
Hide comment
@eddelbuettel

eddelbuettel Apr 26, 2017

Member

Also see #665

Member

eddelbuettel commented Apr 26, 2017

Also see #665

eddelbuettel added a commit that referenced this issue Apr 29, 2017

Merge pull request #686 from RcppCore/bugfix/issue685
suggested fix for maacheck (closes #685)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment