I was examining the JNI output from SWIG and noticed that I could get a NULL pointer dereference if I was wrapping char** foo(void) with
a STRING_ARRAY and foo() returned NULL:
result = (char **)foo();
const jclass clazz = (*jenv)->FindClass(jenv, "java/lang/String");
while (result[len]) len++; // dereference NULL here
The patch I attached simply wraps all the %typemap(out) code in an if test.
Log in to post a comment.