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
{{ message }}
Repository navigation
RFunction params with an embedded NUL longjmp past C++ RPC handlers #19697
#19683 refuses embedded NULs in JSON-RPC params before calling R-implemented handlers (callRHandler() in RJsonRpc.cpp). C++ handlers that pass a client string to RFunction::addParam() have the same exposure. json::Value::getString() keeps the NUL, and sexp::create(const std::string&) builds the string with Rf_mkCharLenCE. R then raises embedded nul in string while the arguments are built, outside the protected call, so the error longjmps past the handler and the RPC is never answered. Example: getRmdPublishDetails() in SessionRSConnect.cpp, with a NUL in target.
Related: create(const std::string&) raises an error on a NUL, while the std::vector / std::set / map overloads and JSON object member names go through mkCharUtf8() -> Rf_mkCharCE(), which silently cuts the string off at the NUL.
Proposed direction: scan string-bearing params and names in RFunction::addParam(), record the first problem and return it from call(), and build every string create() overload on one mkChar helper. The callRHandler() check then moves there. Wrapping each create() in executeSafely() is the generic alternative, but it runs R_ToplevelExec and swaps R's error handler on every parameter, on a hot path.
Activity
keep r errors from longjmping past r::sexp lookups and rpc handlers
keep the rpc backstop on the main thread, and deliver a response once
answer an rpc an r error interrupted with R_UnwindProtect, not R_Topl…
run an rpc's after-response work outside the backstop; re-arm caught …
define NotebookQueueUnit::docType(); skip malformed notebook units; h…
keep r errors from longjmping past rpc handlers and r::sexp callers (#…