REngine icon indicating copy to clipboard operation
REngine copied to clipboard

Potential NullPointerException in REXPGenericVector and REXPList toDebugString()

Open JoshStark opened this issue 2 years ago • 0 comments

The call to REXPGenericVector#toDebugString() or REXPList#toDebugString() may potentially throw a NullPointerException if the vector/list contains a null element. This can occur in some circumstances if an evaluation for source(...) is called on a script which contains function definitions.

For example, if i call .eval("source('myScript.R')") where myScript.R contains a simple function definition:

foo <- function(bar) {
    return(bar)
}

The REXP output will be an instance of REXPGenericVector containing an RList payload with two items: item0 is null, and item1 is a logical value.

For our use-case, it is quite common to source an ad-hoc library of functions to be used as part of an Rserve session, but when debugging, it falls over. Would it be possible to put in a null-check into toDebugString() in REXP classes which need to iterate over a list payload?

JoshStark avatar Oct 10 '23 10:10 JoshStark