Re: bug in VMsystem.arraycopy
Etienne Gagnon <[email protected]> Fri, 06 Jan 2006 10:31:59 -0500
| Newsgroups | gmane.comp.java.vm.sablevm.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Michael, Thanks for the example. To investigate the problem, I instrumented sablevm to give more information just before throwing the exception in arraycopy(). I have attached the patch against sablevm 1.13 (should probably work against 1.11). It seems the bug is not in SableVM but somewhere in the class libraries... There is an attempt to copy "-1" element from an array to another. Here's what I get: 2006/01/06 10:25:18:304 GMT-05:00 [INFO] WhitelistHandler - Whitelist Handler initialized. JESSIE, alias=localhost-cert pwd=key_abc123 JESSIE, alias=localhost pwd=key_abc123 before decodeKey 1 arraycopy(primitive[8],1,primitive[8],0,-1) aha java.lang.ArrayIndexOutOfBoundsException at java.lang.VMSystem.arraycopy (VMSystem.java) at java.lang.System.arraycopy (System.java:238) ... Etienne [email protected] wrote: > I'm trying to port a crypto application to sablevm. Let me tell you, > there are tons of issues with this (most of them in the realm of > security providers) - the latest one seems to point directly to sablevm though. -- Etienne M. Gagnon, Ph.D. http://www.info2.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ _______________________________________________ SableVM-user mailing list [email protected] http://sablevm.org/lists/control/listinfo/sablevm-user
patch
(text/plain, 759 B)
Index: src/libsablevm/java_lang_VMSystem.c
===================================================================
--- src/libsablevm/java_lang_VMSystem.c (revision 4748)
+++ src/libsablevm/java_lang_VMSystem.c (working copy)
@@ -121,6 +121,14 @@
|| (_svmt_u32) dst_position + (_svmt_u32) length >
(_svmt_u32) dst_instance->size)
{
+ _svmf_printf (env, stderr, "arraycopy(%s[%d],%d,%s[%d],%d,%d)\n",
+ ((src_type->base_type ==
+ SVM_TYPE_REFERENCE) ? src_type->name : "primitive"),
+ src_instance->size, src_position,
+ ((dst_type->base_type ==
+ SVM_TYPE_REFERENCE) ? dst_type->name : "primitive"),
+ dst_instance->size, dst_position, length);
+
_svmf_error_ArrayIndexOutOfBoundsException (env);
goto end;
}