DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26049>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26049
Incorrect verification of class files
Summary: Incorrect verification of class files
Product: BCEL
Version: 5.1
Platform: PC
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: Other
Component: Main
AssignedTo: [email protected]
ReportedBy: [email protected]
Hi,
JustIce indicates that the storing of a newly created object in a local before
calling it's constructor as an error. However, this is incorrect as the local
is not accessed along any control flow path before the constructor is called.
This is also safe in a multithreaded setting. Also, the same class file is well
interpreted by java interpreters from SUN, Blackdown, and IBM. Moreover, there
is no restriction on handling (not using) of uninitialized objects in the JVM spec.
ASM output of the correponding class file and JustIce' output are inlined.
public static main ([Ljava/lang/String;)V
NEW excpsync
ASTORE 1
ALOAD 1
INVOKESPECIAL excpsync <init> ()V
ALOAD 1
ASTORE 1
NEW java/lang/Thread
ASTORE 2
ALOAD 2
ALOAD 1
INVOKESPECIAL java/lang/Thread <init> (Ljava/lang/Runnable;)V
ALOAD 2
INVOKEVIRTUAL java/lang/Thread start ()V
NEW java/lang/Thread
ASTORE 2
NEW f
ASTORE 3
ALOAD 3
INVOKESPECIAL f <init> ()V
ALOAD 2
ALOAD 3
INVOKESPECIAL java/lang/Thread <init> (Ljava/lang/Runnable;)V
ALOAD 2
INVOKEVIRTUAL java/lang/Thread start ()V
LDC "Hi"
ASTORE 2
ALOAD 1
ALOAD 2
PUTFIELD excpsync o Ljava/lang/String;
ALOAD 2
PUTSTATIC excpsync t Ljava/lang/String;
RETURN
MAXSTACK = 2
MAXLOCALS = 4
JustIce by Enver Haase, (C) 2001-2002.
<http://bcel.sourceforge.net>
<http://jakarta.apache.org/bcel>
Now verifying: excpsync
Pass 1:
VERIFIED_OK
Passed verification.
Pass 2:
VERIFIED_OK
Passed verification.
Pass 3a, method number 0 ['public void <init>()']:
VERIFIED_OK
Passed verification.
Pass 3b, method number 0 ['public void <init>()']:
VERIFIED_OK
Passed verification.
Pass 3a, method number 1 ['public static void main(String[] arg0)']:
VERIFIED_OK
Passed verification.
Pass 3b, method number 1 ['public static void main(String[] arg0)']:
VERIFIED_REJECTED
Constraint violated in method 'public static void main(String[] arg0)':
Instruction ASTORE constraint violated: Working on an uninitialized object
'<UNINITIALIZED OBJECT OF TYPE 'excpsync'>'.
InstructionHandle: 3: astore_1[76](1)
Execution Frame:
Local Variables:
0: java.lang.String[]
1: <unknown object>
2: <unknown object>
3: <unknown object>
OperandStack:
Slots used: 1 MaxStack: 2.
<UNINITIALIZED OBJECT OF TYPE 'excpsync'> (Size: 1)
Execution flow:
0: new 12 [InstructionContext]
3: astore_1 [InstructionContext]
Pass 3a, method number 2 ['public void run()']:
VERIFIED_OK
Passed verification.
Pass 3b, method number 2 ['public void run()']:
VERIFIED_OK
Passed verification.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.