Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 58832 invoked from network); 14 Aug 2007 14:51:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Aug 2007 14:51:52 -0000 Received: (qmail 1704 invoked by uid 500); 14 Aug 2007 14:51:50 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 1686 invoked by uid 500); 14 Aug 2007 14:51:50 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 1677 invoked by uid 99); 14 Aug 2007 14:51:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Aug 2007 07:51:50 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Aug 2007 14:51:51 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 44E527141F0 for ; Tue, 14 Aug 2007 07:51:31 -0700 (PDT) Message-ID: <26200498.1187103091275.JavaMail.jira@brutus> Date: Tue, 14 Aug 2007 07:51:31 -0700 (PDT) From: "Gregory Shimansky (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-4359) [buildtest][vts] VM does not reject class file with contains incorrect InnerClasses attribute with duplicate entries in classes array In-Reply-To: <10661706.1183706224652.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-4359?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gregory Shimansky updated HARMONY-4359: --------------------------------------- Summary: [buildtest][vts] VM does not reject class file with contains incorrect InnerClasses attribute with duplicate entries in classes array (was: [drlvm][classloader] VM does not reject class file with contains incorrect InnerClasses attribute with duplicate entries in classes array) > [buildtest][vts] VM does not reject class file with contains incorrect InnerClasses attribute with duplicate entries in classes array > ------------------------------------------------------------------------------------------------------------------------------------- > > Key: HARMONY-4359 > URL: https://issues.apache.org/jira/browse/HARMONY-4359 > Project: Harmony > Issue Type: Bug > Components: DRLVM > Reporter: Vera Petrashkova > Assignee: Gregory Shimansky > Priority: Minor > Attachments: H4359.patch, InnerClassAtr.zip > > > According to the J2SE VM specifications of InnerClasses attribute: > The InnerClasses attribute has the following format: > InnerClasses_attribute { > u2 attribute_name_index; > u4 attribute_length; > u2 number_of_classes; > { > u2 inner_class_info_index; > u2 outer_class_info_index; > u2 inner_name_index; > u2 inner_class_access_flags; > } classes[number_of_classes]; > } > and > classes [] > Every CONSTANT_Class_info entry in the constant pool table which represents a class or interface > that is not a package member must have exactly one corresponding entry in the "classes" array. > But VM does not reject class if its InnerClasses attribute contains 2 entries in "classes" array > and they correspond the same CONSTANT_Class_info element in constant pool table. > To reproduce this issue run the following test: > ---------icA.ccode----------- > magic = xCAFEBABE > minor_version = 3 > major_version = 45 > constant_pool_count = 19 > constant_pool { > /* #1 */ Method = #12 #7 > /* #2 */ Class = #11 > /* #3 */ UTF8 = "java/lang/Object" > /* #4 */ UTF8 = "SourceFile" > /* #5 */ UTF8 = "" > /* #6 */ UTF8 = "icA.ccode" > /* #7 */ NameAndType = #5 #10 > /* #8 */ UTF8 = "Code" > /* #9 */ UTF8 = "test" > /* #10 */ UTF8 = "()V" > /* #11 */ UTF8 = "icA" > /* #12 */ Class = #3 > /* #13 */ UTF8 = "InnerClasses" > /* #14 */ Class = #16 > /* #15 */ Class = #17 > /* #16 */ UTF8 = "pack/inner$nestedClass" > /* #17 */ UTF8 = "inner" > /* #18 */ UTF8 = "nestedClass" > } > access_flags = PUBLIC SUPER // x21 > this_class = #2 > super_class = #12 // "java/lang/Object" > interfaces_count = 0 > fields_count = 0 > methods_count = 2 > methods { > method { > access_flag = PUBLIC // x01 > name_index = #5 // "" > descriptor_index = #10 // "()V" > attributes_count = 1 > attributes { > attribute Code { > attribute_name_index = #8 // "Code" > attribute_length = 17 > max_stack = 1 > max_locals = 1 > code_length = 5 > code asm { > 0: aload_0 > 1: invokespecial #1 > 4: return > } > exception_table_length = 0 > attributes_count = 0 > } > } > } > // Test method > method { > access_flag = PUBLIC // x01 > name_index = #9 // "test" > descriptor_index = #10 // "()V" > attributes_count = 1 > attributes { > attribute Code { > attribute_name_index = #8 // "Code" > attribute_length = 13 > max_stack = 1 > max_locals = 1 > code_length = 1 > code asm { > 0: return > } > exception_table_length = 0 > attributes_count = 0 > } > } > } > } > attributes_count = 1 > attributes { > attribute InnerClasses { > attribute_name_index = #13 > attribute_length = 18 > number_of_classes = 2 > InnerClass { // Tested classes array with two same entries for the class #14 > inner_class_info_index = #14 // "pack/inner$nestedClass" > outer_class_info_index = #15 // "inner" > inner_name_index = #17 > inner_class_access_flags = Public > } > InnerClass { // Tested classes array with two same entries for the class #14 > inner_class_info_index = #14 // "pack/inner$nestedClass" > outer_class_info_index = #15 // "inner" > inner_name_index = #17 > inner_class_access_flags = Public > } > } > } > -----------------------test.java------------------ > public class test { > public static void main(String[] args) { > try { > Class.forName("icA"); > System.out.println("Test failed. ClassFormatError was not thrown"); > } catch (ClassFormatError e) { > System.out.println("Test passed: " + e); > } catch (Throwable e){ > System.out.println("Test failed. Unexpected error was thrown"); > e.printStackTrace(); > } > } > } > --------------------- > Use icA class file from attachment. > Output is: > Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable. > java version "1.5.0" > pre-alpha : not complete or compatible > svn = r551077, (Jun 27 2007), Windows/ia32/msvc 1310, release build > http://harmony.apache.org > Test failed. ClassFormatError was not thrown > This test also fails on RI but is passes on BEA JRockit > ============================= > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode) > Test failed. ClassFormatError was not thrown > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64) > BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC: System op > timized over throughput (initial strategy singleparpar)) > Test passed: java.lang.ClassFormatError: icA : duplicate InnerClass entry: 1 > This bug causes the failure of VTS test > vm/jvms/classFile/attributes/innerClasses/innerClasses12/innerClasses12.xml -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.