This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug java/35979] New: JNI method NewStringUTF crashes when passed a NULL pointer
- From: "thomas dot g dot girard at free dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 19 Apr 2008 12:06:48 -0000
- Subject: [Bug java/35979] New: JNI method NewStringUTF crashes when passed a NULL pointer
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hello,
when running java-gnome 4 unit tests, I've found out that gij NewStringUTF
implementation crashes when its argument is NULL. Indeed in natString.cc the
very first line of _Jv_NewStringUTF(const char *bytes) calls strlen(bytes),
without checking whether bytes is NULL or not. Hence the crash.
Sun's implementation does not crash: it returns NULL instead.
However it seems gij implementation is correct according to
http://java.sun.com/docs/books/jni/html/functions.html#65644:
"Return Values. Returns a local reference to a string object, or NULL if the
string cannot be constructed. Returns NULL if and only if an invocation of this
function has thrown an exception."
Should gij implementation be changed to handle NULL? I've checked that the
crash should still occur on the trunk, r134466
--
Summary: JNI method NewStringUTF crashes when passed a NULL
pointer
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: thomas dot g dot girard at free dot fr
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35979