check for size.
* src/native/vm/sun/jvm.c (JVM_NewMultiArray): Explicitely check for
exceptions.
length = array_length_get((java_handle_t *) ia);
length = array_length_get((java_handle_t *) ia);
+ /* We check here for exceptions thrown in array_length_get,
+ otherwise these exceptions get overwritten by the following
+ IllegalArgumentException. */
+
+ if (length < 0)
+ if ((length <= 0) || (length > /* MAX_DIM */ 255)) {
+ exceptions_throw_illegalargumentexception();
+ return NULL;
+ }
+
/* XXX This is just a quick hack to get it working. */
dims = MNEW(long, length);
/* XXX This is just a quick hack to get it working. */
dims = MNEW(long, length);
a ... Java array
RETURN VALUE:
a ... Java array
RETURN VALUE:
- 0 ... exception thrown
- >0 ... length of the Java array
+ -1 ... exception thrown
+ >= 0 ... length of the Java array
*******************************************************************************/
*******************************************************************************/
if (a == NULL) {
exceptions_throw_nullpointerexception();
if (a == NULL) {
exceptions_throw_nullpointerexception();
if (!class_is_array(c)) {
/* exceptions_throw_illegalargumentexception("Argument is not an array"); */
exceptions_throw_illegalargumentexception();
if (!class_is_array(c)) {
/* exceptions_throw_illegalargumentexception("Argument is not an array"); */
exceptions_throw_illegalargumentexception();
}
size = LLNI_array_size(a);
}
size = LLNI_array_size(a);
- if ((size <= 0) || (size > /* MAX_DIM */ 255)) {
- exceptions_throw_illegalargumentexception();
- return 0;
- }
-