You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Judit Knoll (Jira)" <ji...@apache.org> on 2023/10/10 08:38:00 UTC
[jira] [Updated] (BCEL-370) CONSTANT_Dynamic is not handled in LDC
[ https://issues.apache.org/jira/browse/BCEL-370?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Judit Knoll updated BCEL-370:
-----------------------------
Description:
The [org.apache.bcel.generic.LDC|https://github.com/apache/commons-bcel/blob/master/src/main/java/org/apache/bcel/generic/LDC.java] class does not support [Const.CONSTANT_Dynamic|https://github.com/apache/commons-bcel/blob/master/src/main/java/org/apache/bcel/Const.java#L683C52-L683C52] (Condy, Dynamic class-file constant) in the following methods:
* {{public Type getType(final ConstantPoolGen cpg);}}
* {{public Object getValue(final ConstantPoolGen cpg);}}
JaCoCo >= 0.8.4 (see [jacoco/pull/845|https://github.com/jacoco/jacoco/pull/845]) creates class files which have Constant_Dynamic. When visiting the instructions of a method and calling either of the mentioned method of LDC, an IllegalArgumentException occurs: "{{Unknown or invalid constant type at 32}}".
This error causes a problem, when someone tries to analyze a class file containing condy with spotbugs, which uses BCEL. The error was originally found in spotbugs (see [spotbugs/issues/2503|https://github.com/spotbugs/spotbugs/issues/2503] and [spotbugs/pull/2512|https://github.com/spotbugs/spotbugs/pull/2512]).
Attached a class built by Java 17 and JaCoCo 0.8.9., the source of this file is [spotbugs/issues/2503/comment|https://github.com/spotbugs/spotbugs/issues/2503#issuecomment-1679085646].
The issue can be reproduced by calling the [org.apache.bcel.generic.TypeTestCase.testLDC(String className)|https://github.com/apache/commons-bcel/blob/master/src/test/java/org/apache/bcel/generic/TypeTestCase.java#L71] method with the attached class file as a parameter.
was:
The [org.apache.bcel.generic.LDC|https://github.com/apache/commons-bcel/blob/master/src/main/java/org/apache/bcel/generic/LDC.java] class does not support [Const.CONSTANT_Dynamic|https://github.com/apache/commons-bcel/blob/master/src/main/java/org/apache/bcel/Const.java#L683C52-L683C52] (Condy, Dynamic class-file constant) in the following methods:
* {{public Type getType(final ConstantPoolGen cpg);}}
* {{public Object getValue(final ConstantPoolGen cpg);}}
JaCoCo >= 0.8.4 (see [jacoco/pull/845|https://github.com/jacoco/jacoco/pull/845]) creates class files which have Constant_Dynamic. When visiting the instructions of a method and calling either of the mentioned method of LDC, an IllegalArgumentException occurs: "{{Unknown or invalid constant type at 32}}".
This error causes a problem, when someone tries to analyze a class file containing condy with spotbugs, which uses BCEL. The error was originally found in spotbugs (see [spotbugs/issues/2503|https://github.com/spotbugs/spotbugs/issues/2503] and [spotbugs/pull/2512|https://github.com/spotbugs/spotbugs/pull/2512]).
Attached a class built by Java 17 and JaCoCo 0.8.9., the source of this file is [spotbugs/issues/2503/comment|https://github.com/spotbugs/spotbugs/issues/2503#issuecomment-1679085646].
The issue can be reproduced by trying to read the calling the [org.apache.bcel.generic.TypeTestCase.testLDC(String className)|https://github.com/apache/commons-bcel/blob/master/src/test/java/org/apache/bcel/generic/TypeTestCase.java#L71] method with the attached class file as a parameter.
> CONSTANT_Dynamic is not handled in LDC
> --------------------------------------
>
> Key: BCEL-370
> URL: https://issues.apache.org/jira/browse/BCEL-370
> Project: Commons BCEL
> Issue Type: Bug
> Affects Versions: 6.7.0
> Reporter: Judit Knoll
> Priority: Major
> Attachments: Foo.class
>
>
> The [org.apache.bcel.generic.LDC|https://github.com/apache/commons-bcel/blob/master/src/main/java/org/apache/bcel/generic/LDC.java] class does not support [Const.CONSTANT_Dynamic|https://github.com/apache/commons-bcel/blob/master/src/main/java/org/apache/bcel/Const.java#L683C52-L683C52] (Condy, Dynamic class-file constant) in the following methods:
> * {{public Type getType(final ConstantPoolGen cpg);}}
> * {{public Object getValue(final ConstantPoolGen cpg);}}
> JaCoCo >= 0.8.4 (see [jacoco/pull/845|https://github.com/jacoco/jacoco/pull/845]) creates class files which have Constant_Dynamic. When visiting the instructions of a method and calling either of the mentioned method of LDC, an IllegalArgumentException occurs: "{{Unknown or invalid constant type at 32}}".
> This error causes a problem, when someone tries to analyze a class file containing condy with spotbugs, which uses BCEL. The error was originally found in spotbugs (see [spotbugs/issues/2503|https://github.com/spotbugs/spotbugs/issues/2503] and [spotbugs/pull/2512|https://github.com/spotbugs/spotbugs/pull/2512]).
> Attached a class built by Java 17 and JaCoCo 0.8.9., the source of this file is [spotbugs/issues/2503/comment|https://github.com/spotbugs/spotbugs/issues/2503#issuecomment-1679085646].
> The issue can be reproduced by calling the [org.apache.bcel.generic.TypeTestCase.testLDC(String className)|https://github.com/apache/commons-bcel/blob/master/src/test/java/org/apache/bcel/generic/TypeTestCase.java#L71] method with the attached class file as a parameter.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)