You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 :
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
We have just a single use of UNPROTECT_PTR which is good. It's in src/rbindlist.c.
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: