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

protect call inside Rcpp::Environment<>::namespace_env() #1010

Merged
merged 4 commits into from
Nov 2, 2019

Conversation

romainfrancois
Copy link
Contributor

The result of Rf_lang2() is not protected so might be deleted by a garbage collection further down the line.

romainfrancois added a commit to tidyverse/dplyr that referenced this pull request Oct 31, 2019
@kevinushey
Copy link
Contributor

LGTM!

It looks like there are a number of places where we fail to protect the created call, so we might want to audit all of those usages and try to fix them up.

@eddelbuettel
Copy link
Member

Quick ag search for Rf_lang2 in the headers find most uses protected by now. Besides the one identified here, I see one more in generated/Function__opearator.h and one in r_cast.h.

Environment.h has another related use with Rf_lang3 and one with Rf_lang4; both probably also need protection.

@kevinushey
Copy link
Contributor

There are also a couple cases where we use Rf_mkString() within calls to Rf_lang*(); IIRC this can be dangerous because (depending on the order the compiler decides to materialize function arguments) this can lead to (very rare) GC errors as well.

We should likely pull those out and protect those as well.

@eddelbuettel
Copy link
Member

We could split those two tasks between us :)

@eddelbuettel
Copy link
Member

No 'change to worse' in reverse depends: RcppCore/rcpp-logs@d855acb so merging.

@eddelbuettel eddelbuettel merged commit 47daf66 into RcppCore:master Nov 2, 2019
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

Successfully merging this pull request may close these issues.

3 participants