Name: viR10068 Date: 12/22/2000
This bug is a copy of bug 4349751 which was integrated in kest-linux-rc1
on Jun 30 2000. However, the same bug shows in Merlin-beta-b45 and prevents
from passing two JCK tests:
vm/classfmt/mth/mthsnd001/mthsnd00103m1/mthsnd00103m1.html
vm/classfmt/fld/fldsnd001/fldsnd00104m1/fldsnd00104m1.html
> ======================================================================
> Class format checker doesn't reject classes with duplicated fields or
> methods because of the error in heap sort algorithm implementation.
>
> It looks like duplicated members detection depends on the fields/methods ordering.
> We suppose that the bug occurs because of error in implementation of heap sort
> algorithm in class format checker.
>
> We believe that the following fix will help.
> In file /src/share/native/common/check_format.c (line 1902) variable secondChild
> should be initialized like this
>
> int secondChild = firstChild + 2;
>
> instead of
>
> int secondChild = firstChild + 4;
>
> ======================================================================
======================================================================
I can't find the JCK tests that failed. Please add a pointer to the test sources or attach the test files. Thanks.
wei.tao@eng 2001/03/30
The following example from the bug report 4349751 allows to reproduce this failure:
"Classes t1 and t2 in example below are nearly equal except of the different
order of their fields. Class t1 is rejected but t2 is loaded successfully.
-------------------------------------------------------------- t1.jasm --
class t1 {
Field f:I;
Field f:I;
Field g:I;
Field h:I;
public static Method main:"([Ljava/lang/String;)V"
stack 0 locals 1
{
return;
}
} // end Class t1
------------------------------------------------------------- t2.jasm --
class t2 {
Field f:I;
Field g:I;
Field f:I;
Field h:I;
public static Method main:"([Ljava/lang/String;)V"
stack 0 locals 1
{
return;
}
} // end Class t2
-----------------------------------------------------------------------
Execution log:
% uname -a
SunOS novo79 5.8 Generic_108528-03 sun4u sparc SUNW,Ultra-1
% /export/ld25/java/dest/jdk1.4.0beta-b37/solsparc/bin/java -version
java version "1.4.0beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0beta-b37)
Java HotSpot(TM) Client VM (build 1.4beta-B37, mixed mode)
% /export/ld25/java/dest/jdk1.4.0beta-b37/solsparc/bin/java t1
Exception in thread "main" java.lang.ClassFormatError: t1 (Repeative field name/signature)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
% /export/ld25/java/dest/jdk1.4.0beta-b37/solsparc/bin/java t2;echo $status
0
%
The same behavior may be demonstrated for methods too. We tested class which has
4 methods (init, main and two duplicated) in all possible order combinations
(24 combinations in total) and found out that JVM was failed to reject class in 50%
of cases."
Compiled classes t1.class and t2.class are in the attachment.
###@###.### 2001-04-02
- relates to
-
JDK-4349751 Class format checker doesn't reject classes with duplicated fields/methods
-
- Closed
-