2003-01-31 Tom Tromey <tromey@redhat.com>
+ * jni.cc (_Jv_JNI_NewObjectArray): Check that initializer can be
+ cast to element type.
+ (_Jv_JNI_SetObjectArrayElement): Check array bounds.
+ (_Jv_JNI_GetObjectArrayElement): Likewise.
+
* Makefile.in: Rebuilt.
* Makefile.am (cond_x_ltlibrary): Renamed library to
lib-gnu-awt-xlib.la.
// jni.cc - JNI implementation, including the jump table.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
elementClass = unwrap (elementClass);
init = unwrap (init);
+ _Jv_CheckCast (elementClass, init);
jarray result = JvNewObjectArray (length, elementClass, init);
return (jarray) wrap_value (env, result);
}
(JNICALL _Jv_JNI_GetObjectArrayElement) (JNIEnv *env, jobjectArray array,
jsize index)
{
+ if ((unsigned) index >= (unsigned) array->length)
+ _Jv_ThrowBadArrayIndex (index);
jobject *elts = elements (unwrap (array));
return wrap_value (env, elts[index]);
}
value = unwrap (value);
_Jv_CheckArrayStore (array, value);
+ if ((unsigned) index >= (unsigned) array->length)
+ _Jv_ThrowBadArrayIndex (index);
jobject *elts = elements (array);
elts[index] = value;
}