omegahat / RCurl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

userpwd=TRUE causes segfault

rsaporta opened this issue · comments

I'm getting a reproducible segfault when userpwd was (accidentally) set to TRUE

Offending line:

 url.exists("https://www.test.com", userpwd=TRUE)

What was executed:

R --vanilla
library(RCurl)
url.exists("https://www.test.com", userpwd=TRUE)

Reproduced on two separate machines

REMOTE centOS

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-redhat-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] RCurl_1.95-4.1 bitops_1.0-6

loaded via a namespace (and not attached):
[1] data.table_1.8.10

LOCAL Mac OS X

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] RCurl_1.95-4.3 bitops_1.0-6

Thanks for the report.
The issue is that the libcurl library is expecting a character string with the user and password information, e.g. "login:passwd". But the TRUE value is not in that format and !!crash!!
The RCurl package doesn't check the types coming in for the different libcurl options. It can do that, but this appears to be the first reported case of an issue. There is a lot of overhead in checking the types. I can put it on my todo list if it is a serious issue.
Thanks
D.

Certainly not a high priority from my point of view. In fact, I found the bug only by chance, by mis-assigning a variable name.

My only concern is the segfault. Is there somewhere where such errors could be caught and handled without crashing the entire R session?

I finally had a few minutes to make an addition to check for this case and some others. Thanks