Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up
Tomas Kalibera contacted me :
Hi Matt,
I found data.table uses UNPROTECT_PTR. This is completely legal API, but
I discovered it is dangerously designed, I replaced it in all of base R
code and I would recommend phasing it out from all packages as well. The
problem is that one can get very nasty bugs due to interaction with
UNPROTECT. It is only really needed in generated parsers (for which I
created a new API), in all other code and also in data.table it should
be possible to replace with UNPROTECT. Could you please have a look and
update this in some next version? The problem is described in detail in
my blog post :
https://developer.r-project.org/Blog/public/2018/12/10/unprotecting-by-value/index.html
but the core problem is easy to understand: when one protects the same
pointer multiple times (which can happen..), one can accidentally
UNPROTECT_PTR the unintended one, and a following UNPROTECT may
unprotect prematurely
Thanks!
Tomas