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

marshal: turn connections into invalid connections #3

Open
HenrikBengtsson opened this issue Mar 2, 2022 · 1 comment
Open

marshal: turn connections into invalid connections #3

HenrikBengtsson opened this issue Mar 2, 2022 · 1 comment

Comments

@HenrikBengtsson
Copy link
Collaborator

HenrikBengtsson commented Mar 2, 2022

For example, if we detect a connection with index K, we can change its index to -1. If the connection is never used, all is fine, and if it's used it'll trigger a run-time error.

The background is that R does not protect against using connections in other R sessions. This should ideally be fixed in R itself, cf. HenrikBengtsson/Wishlist-for-R#81

@HenrikBengtsson
Copy link
Collaborator Author

Gist:

> con <- rawConnection(raw(), open = "w")
> con
A connection with                           
description "raw()"        
class       "rawConnection"
mode        "w"            
text        "binary"       
opened      "opened"       
can read    "no"           
can write   "yes"          
> str(con)
 'rawConnection' int 5
 - attr(*, "conn_id")=<externalptr> 

Invalidate above connection:

> con[1] <- -1L
> str(con)
 'rawConnection' int -1
 - attr(*, "conn_id")=<externalptr> 
> con
A connection, specifically, 'rawConnection', but invalid.

@HenrikBengtsson HenrikBengtsson transferred this issue from another repository Oct 22, 2022
@HenrikBengtsson HenrikBengtsson transferred this issue from another repository Oct 22, 2022
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

No branches or pull requests

1 participant