Jérôme Leroux created BCEL-190:
----------------------------------
Summary: Type inference computing not correct in bytecode verifier
Key: BCEL-190
URL: https://issues.apache.org/jira/browse/BCEL-190
Project: Commons BCEL
Issue Type: Bug
Components: Verifier
Affects Versions: 6.0
Reporter: Jérôme Leroux
As described in the verifier documentation, there are some known issues in the
variable type inference computing.
{quote}
JustIce uses object generalization during pass 3b, as supposed by
Sun. However, there are better methods such as the idea proposed by
Staerk et al.: using sets of object types. JustIce may reject code
that is not rejected by traditional JVM-internal verifiers for this
reason. The corresponding checks all have some "TODO" tag with an
explanation; they're all in the 'Pass3bVerifier' files.
Users encountering problems should simply comment them out (or
uncomment them) as they like.
{quote}
Here is a simple example that reproduces this issue. It is rejected by the
verifier:
{code:java}
public void test1(boolean b) throws IOException {
Appendable s;
if(b) {
s = System.out;
}
else {
s = new StringBuilder();
}
test2(s);
}
public void test2(Appendable s){}
{code}
To avoid this example to be rejected by the verifier, it should be more
tolerant. This may lead to accept some invalid bytecode but IMHO it is
preferable. Actually there are already some bugs that accept invalid bytecode,
especially in invokeinterface analyze.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)