diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-08 14:18:24 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-08 14:18:24 +0000 |
commit | b831e1da3886dda7861f60be8d7646a2deec37cd (patch) | |
tree | d5ffecfa0b304e63a02d6498298f2274abb68b2c /libjava/jni.cc | |
parent | ca76500bccea30030edeaa719eb187b59f3badfc (diff) | |
download | gcc-b831e1da3886dda7861f60be8d7646a2deec37cd.tar.gz |
2002-02-08 Martin Kahlert <martin.kahlert@infineon.com>
* jni.cc (_Jv_JNI_NewLocalRef): Make sure, that NULL frame is not
dereferenced.
(_Jv_JNI_AttachCurrentThread): Produce full featured env->locals
frame.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49615 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/jni.cc')
-rw-r--r-- | libjava/jni.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libjava/jni.cc b/libjava/jni.cc index 24ea04876d1..9ee0df4a451 100644 --- a/libjava/jni.cc +++ b/libjava/jni.cc @@ -1,6 +1,6 @@ // jni.cc - JNI implementation, including the jump table. -/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation This file is part of libgcj. @@ -325,7 +325,7 @@ _Jv_JNI_NewLocalRef (JNIEnv *env, jobject obj) // If we found a slot, or if the frame we just searched is the // mark frame, then we are done. - if (done || frame->marker != MARK_NONE) + if (done || frame == NULL || frame->marker != MARK_NONE) break; } @@ -2131,6 +2131,15 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv, void *args) _Jv_Free (env); return JNI_ERR; } + + env->locals->marker = MARK_SYSTEM; + env->locals->size = FRAME_SIZE; + env->locals->next = env->locals; + env->locals = NULL; + + for (int i = 0; i < env->locals->size; ++i) + env->locals->vec[i] = NULL; + *penv = reinterpret_cast<void *> (env); // This thread might already be a Java thread -- this function might |