Last active
November 30, 2018 19:51
-
-
Save mlt/d8ee0be6186f9847d41bf88888e75713 to your computer and use it in GitHub Desktop.
R_ParseVector won't report an error to embedder. Modified example from tests/Embedding/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mlt@ubuntu-vm:~/r-base-3.4.4/tests/Embedding$ R_HOME=/usr/lib/R ./RParseEval --slave || echo $? | |
Error: bad value | |
Fatal error: unable to initialize the JIT | |
2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "embeddedRCall.h" | |
#include <R_ext/Parse.h> | |
int | |
main(int argc, char *argv[]) | |
{ | |
SEXP e, tmp; | |
int hadError; | |
ParseStatus status; | |
init_R(argc, argv); | |
PROTECT(tmp = mkString("{deadbeef<-function(,bad){};plot(1:10, pch=\"+\"); print(1:10)}")); | |
PROTECT(e = R_ParseVector(tmp, 1, &status, R_NilValue)); | |
if (status != PARSE_OK) | |
{ | |
printf("R_suicide is called instead of me because it longjmp into terminated setuploop with messed up doneit\n"); | |
printf("We need a wrapper for embedded R around R_ParseVector that would SETJMP(R_Toplevel.cjmpbuf) first.\n"); | |
} | |
PrintValue(e); | |
R_tryEval(VECTOR_ELT(e,0), R_GlobalEnv, &hadError); | |
UNPROTECT(2); | |
end_R(); | |
return(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment