commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (BCEL-90) array elements' type not always verified by JustIce
Date Thu, 24 Apr 2014 13:52:16 GMT

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

Emmanuel Bourg updated BCEL-90:
-------------------------------

          Component/s:     (was: Main)
                       Verifier
          Description: 
The following class is accepted by JustIce (BCEL 5.2), whereas Sun verifier (correctly) rejects
it:

Compiled from "Test.java"
{code}
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

}
{code}

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.

  was:
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.

             Priority: Major
          Environment:     (was: Operating System: All
Platform: All)
    Affects Version/s:     (was: unspecified)
                       5.2
             Priority:   (was: P3)
             Severity:   (was: normal)

> array elements' type not always verified by JustIce
> ---------------------------------------------------
>
>                 Key: BCEL-90
>                 URL: https://issues.apache.org/jira/browse/BCEL-90
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Verifier
>    Affects Versions: 5.2
>            Reporter: Andrzej Wasylkowski
>            Assignee: Apache Commons Developers
>         Attachments: Test.class
>
>
> The following class is accepted by JustIce (BCEL 5.2), whereas Sun verifier (correctly)
rejects it:
> Compiled from "Test.java"
> {code}
> 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
> }
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message