collections icon indicating copy to clipboard operation
collections copied to clipboard

segfault when ht_xptr is missing for dict environment

Open qinwf opened this issue 4 years ago • 5 comments

> k = collections::dict()
> k$ht_xptr = NULL
> k$get("test")

 *** caught segfault ***
address 0x108030040, cause 'memory not mapped'

Traceback:
 1: k$get("test")

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:

Maybe the C code should lock the environment binding or check the existent of ht_xptr or hide ht_xptr from users?

qinwf avatar Jun 21 '20 11:06 qinwf

It is expected though.

randy3k avatar Jun 21 '20 11:06 randy3k

OK

qinwf avatar Jun 21 '20 11:06 qinwf

By the way, why you wanted to access the internal variables?

randy3k avatar Jun 21 '20 17:06 randy3k

Just hanging around the c code and accidentally find a way to crash R.

It is brilliant to use the cons-list as a queue by the way.

But it is not a safe abstraction. I think the R package api should never crash user sessions. Instead, they should throw an R error for these cases.

qinwf avatar Jun 22 '20 02:06 qinwf

Let’s keep it open.

randy3k avatar Jun 22 '20 02:06 randy3k