Bug 41069 - array elements' type not always verified by JustIce
Summary: array elements' type not always verified by JustIce
Status: NEW
Alias: None
Product: BCEL - Now in Jira
Classification: Unclassified
Component: Main (show other bugs)
Version: unspecified
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: issues@commons.apache.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-29 03:56 UTC by Andrzej Wasylkowski
Modified: 2008-02-07 07:30 UTC (History)
0 users



Attachments
the class illustrating the problem (397 bytes, application/octet-stream)
2006-11-29 03:57 UTC, Andrzej Wasylkowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrzej Wasylkowski 2006-11-29 03:56:28 UTC
The following class is accepted by JustIce (BCEL 5.2), whereas Sun verifier (correctly) rejects it:

Compiled from "Test.java"
public class Test extends java.lang.Object{
public Test();
  Code:
   0:   aload_0
   1:   invokespecial   #9; //Method java/lang/Object."<init>":()V
   4:   return

public static void main(java.lang.String[]);
  Code:
   0:   aload_0
   1:   iconst_0
   2:   caload
   3:   return

}

In the "main" method we are trying to read a char from an array of Strings and this is of course type-
incorrect.

My take on the solution is that in the org.apache.bcel.verifier.structurals.InstConstraintVisitor class, in 
the visitCALOAD method, there are only two checks being made: whether the index is of int type, and 
whether there is really an array on the stack.  What is missing is the check, whether the array holds 
element of 'char' type.
Comment 1 Andrzej Wasylkowski 2006-11-29 03:57:32 UTC
Created attachment 19195 [details]
the class illustrating the problem