harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory Shimansky (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-3316) [drlvm]VM throws VerifyError instead of ClassFormatError when class contains incorrect method name
Date Mon, 19 Mar 2007 16:35:32 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-3316?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Gregory Shimansky resolved HARMONY-3316.
----------------------------------------

    Resolution: Fixed

Patch applied at 520001. Please check that it was applied as expected and the bug is gone
now.

> [drlvm]VM throws VerifyError instead of ClassFormatError when class contains incorrect
method name
> --------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3316
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3316
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Assigned To: Gregory Shimansky
>            Priority: Minor
>         Attachments: 3316.patch, WrongMethName.zip
>
>
> If class file contains CONSTANT_NameAndType element which refers to incorrect method
name then
> VM throws expected ClassFormatError when -Xverify option was specified.
> If this option was not set VM throws VerifyError while RI always throws ClassFormatError.
> The following synthetic test demonstrates this issue:
> --------------testWrongMethName.java---------------
> import java.io.*;
> public class testWrongMethName {
>     public static void main (String[] args) {
>         try {
>             Class.forName("WrongMethName");
>         } catch (ClassFormatError e) {
>             System.out.println("Test passed: " + e);
>         } catch (Throwable e) {
>             System.out.println("Test failed: unexpected error" + e);
>             e.printStackTrace(System.out);
>         }
>     }
> }
> -------------WrongMethName.ccode------------------------
> magic = xCAFEBABE
> minor_version = 3
> major_version = 45
> constant_pool_count = 13
> constant_pool {
>   /* #1 */ UTF8 = "WrongMethName"
>   /* #2 */ UTF8 = "java/lang/Object"
>   /* #3 */ Class = #2
>   /* #4 */ Class = #1
>   /* #5 */ UTF8 = "<init>"
>   /* #6 */ UTF8 = "()V"
>   /* #7 */ UTF8 = "Code"
>   /* #8 */ Method = #3 #9
>   /* #9 */ NameAndType = #12 #6    // incorrect #12
>   /* #10 */ UTF8 = "I"
>   /* #11 */ UTF8 = "testF"
>   /* #12 */ UTF8 = "<testF>"
> }
> access_flags = PUBLIC SUPER
> this_class = #4
> super_class = #3
> interfaces_count = 0
> fields_count = 1
> fields {
>     field {
>         access_flag = PUBLIC
>         name_index = #11
>         descriptor_index = #10
>         attributes_count = 0
>     }
> }
> methods_count = 1
> methods {
>     method {
>         access_flag = PUBLIC
>         name_index = #5
>         descriptor_index = #6
>         attributes_count = 1
>         attributes {
>             attribute Code {
>             attribute_name_index = #7
>             attribute_length = 17
>             max_stack = 1
>             max_locals = 1
>             code_length = 5
>             code asm {
>                 0:    aload_0
>                 1:    invokespecial #8
>                 4:    return
>             }
>             exception_table_length = 0
>             attributes_count = 0
>             }
>         }
>     }
> }
> attributes_count = 0
> --------------------------------------
> To run this test use WrongMethName class from attachment
> Output is:
> Test failed: unexpected errorjava.lang.VerifyError: (class: WrongMethName, method: <init>()V)
Uninitialized reference usage
> java.lang.VerifyError: (class: WrongMethName, method: <init>()V) Uninitialized
reference usage
>         at java.lang.ClassLoader.defineClass0(ClassLoader.java)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:414)
>         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:70)
>         at java.net.URLClassLoader.findClassImpl(URLClassLoader.java:1182)
>         at java.net.URLClassLoader$4.run(URLClassLoader.java:624)
>         at java.net.URLClassLoader$4.run(URLClassLoader.java)
>         at java.security.AccessController.doPrivilegedImpl(AccessController.java:171)
>         at java.security.AccessController.doPrivileged(AccessController.java:62)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:622)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:552)
>         at java.lang.ClassLoader$SystemClassLoader.loadClass(ClassLoader.java:938)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java)
>         at java.lang.Class.forName(Class.java:153)
>         at java.lang.Class.forName(Class.java:128)
>         at testWrongMethName.main(testWrongMethName.java:5)
> VM throws VerifyError when Class.forName() is invoked with incorrect class file.
> But it always throws ClassFormatError when we use ClassLoader.defineClass(..) with this
wrong class.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message