| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
The named variant of push_back() allocated the new cons cell before constructing the Symbol for its tag. If the tag name was not yet interned, Rf_install() could allocate and trigger a garbage collection that reclaimed the still-unreachable cell. Construct the Symbol first, matching push_front(). Fixes #1489.
| Back | FazBrowse Home | New Git URL |
Fixes #1489.
The named variant of StretchyList::push_back() allocated the new cons cell before constructing the Symbol for its tag. If the tag name was not yet interned, Rf_install() could allocate and trigger a garbage collection that reclaimed the still-unreachable cell; SET_TAG() then wrote into a reclaimed node, which was subsequently linked into the list. See #1489 for a reproducible example via Rcpp::sourceCpp() and gctorture().
The fix constructs the Symbol before calling Rf_cons(), matching the ordering already used by the named variant of push_front().
Also adds a regression test exercising named push_back() with a freshly generated (never-interned) tag name under gctorture(); the test fails without the header change and passes with it.
Checklist