You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/11/19 14:39:46 UTC

[commons-bcel] branch master updated (3d2f8ea8 -> 90d3d754)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git


    from 3d2f8ea8 Simplify array allocation
     new 58916a50 org.apache.bcel.classfile.StackMapEntry.StackMapEntry(DataInput, ConstantPool) reads signed instead of unsigned shorts from its DataInput.
     new c84f4923 org.apache.bcel.classfile.StackMapType.StackMapType(DataInput, ConstantPool) reads signed instead of unsigned shorts from its DataInput
     new 90d3d754 org.apache.bcel.classfile.ConstantInvokeDynamic.ConstantInvokeDynamic(DataInput)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                                |  3 +++
 .../apache/bcel/classfile/ConstantInvokeDynamic.java   |  2 +-
 .../java/org/apache/bcel/classfile/StackMapEntry.java  | 18 ++++++++++--------
 .../java/org/apache/bcel/classfile/StackMapType.java   |  2 +-
 4 files changed, 15 insertions(+), 10 deletions(-)


[commons-bcel] 02/03: org.apache.bcel.classfile.StackMapType.StackMapType(DataInput, ConstantPool) reads signed instead of unsigned shorts from its DataInput

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit c84f4923bf23c9fb7b53b6eb65fcf4c8b050c47b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 19 09:28:45 2022 -0500

    org.apache.bcel.classfile.StackMapType.StackMapType(DataInput,
    ConstantPool) reads signed instead of unsigned shorts from its DataInput
---
 src/changes/changes.xml                                   | 1 +
 src/main/java/org/apache/bcel/classfile/StackMapType.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 462d059c..4c143861 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -88,6 +88,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">InstructionConstants.DCONST_0 value is wrong (regression from 6.6.0).</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">Avoid internal NPE in org.apache.bcel.util.ClassPath.getInputStream(String, String).</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.StackMapEntry.StackMapEntry(DataInput, ConstantPool) reads signed instead of unsigned shorts from its DataInput.</action>
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.StackMapType.StackMapType(DataInput, ConstantPool) reads signed instead of unsigned shorts from its DataInput.</action>
       <!-- UPDATE -->
       <action                  type="update" dev="ggregory" due-to="Gary Gregory">Bump spotbugs-maven-plugin from 4.7.2.2 to 4.7.3.0 #167.</action>
       <action                  type="update" dev="ggregory" due-to="Dependabot">Bump jmh.version from 1.35 to 1.36 #170.</action>
diff --git a/src/main/java/org/apache/bcel/classfile/StackMapType.java b/src/main/java/org/apache/bcel/classfile/StackMapType.java
index 5f76689c..aff4bcb1 100644
--- a/src/main/java/org/apache/bcel/classfile/StackMapType.java
+++ b/src/main/java/org/apache/bcel/classfile/StackMapType.java
@@ -54,7 +54,7 @@ public final class StackMapType implements Cloneable {
     StackMapType(final DataInput file, final ConstantPool constantPool) throws IOException {
         this(file.readByte(), -1, constantPool);
         if (hasIndex()) {
-            this.index = file.readShort();
+            this.index = file.readUnsignedShort();
         }
         this.constantPool = constantPool;
     }


[commons-bcel] 01/03: org.apache.bcel.classfile.StackMapEntry.StackMapEntry(DataInput, ConstantPool) reads signed instead of unsigned shorts from its DataInput.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit 58916a50ab278004ca97dc63ba76ce0ee0de36f4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 19 09:17:02 2022 -0500

    org.apache.bcel.classfile.StackMapEntry.StackMapEntry(DataInput,
    ConstantPool) reads signed instead of unsigned shorts from its
    DataInput.
---
 src/changes/changes.xml                                |  1 +
 .../java/org/apache/bcel/classfile/StackMapEntry.java  | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 52cca6d8..462d059c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -87,6 +87,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">InstructionConstants.ALOAD_0 value is wrong (regression from 6.6.0).</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">InstructionConstants.DCONST_0 value is wrong (regression from 6.6.0).</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">Avoid internal NPE in org.apache.bcel.util.ClassPath.getInputStream(String, String).</action>
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.StackMapEntry.StackMapEntry(DataInput, ConstantPool) reads signed instead of unsigned shorts from its DataInput.</action>
       <!-- UPDATE -->
       <action                  type="update" dev="ggregory" due-to="Gary Gregory">Bump spotbugs-maven-plugin from 4.7.2.2 to 4.7.3.0 #167.</action>
       <action                  type="update" dev="ggregory" due-to="Dependabot">Bump jmh.version from 1.35 to 1.36 #170.</action>
diff --git a/src/main/java/org/apache/bcel/classfile/StackMapEntry.java b/src/main/java/org/apache/bcel/classfile/StackMapEntry.java
index c23d27c7..a0c305c5 100644
--- a/src/main/java/org/apache/bcel/classfile/StackMapEntry.java
+++ b/src/main/java/org/apache/bcel/classfile/StackMapEntry.java
@@ -26,7 +26,9 @@ import org.apache.bcel.Const;
 
 /**
  * This class represents a stack map entry recording the types of local variables and the of stack items at a given
- * byte code offset. See CLDC specification 5.3.1.2
+ * byte code offset. See CLDC specification 5.3.1.2.
+ *
+ * See also https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.4
  *
  * @see StackMap
  * @see StackMapType
@@ -59,27 +61,27 @@ public final class StackMapEntry implements Node, Cloneable {
             byteCodeOffset = frameType - Const.SAME_LOCALS_1_STACK_ITEM_FRAME;
             typesOfStackItems = new StackMapType[] { new StackMapType(dataInput, constantPool) };
         } else if (frameType == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
-            byteCodeOffset = dataInput.readShort();
+            byteCodeOffset = dataInput.readUnsignedShort();
             typesOfStackItems = new StackMapType[] { new StackMapType(dataInput, constantPool) };
         } else if (frameType >= Const.CHOP_FRAME && frameType <= Const.CHOP_FRAME_MAX) {
-            byteCodeOffset = dataInput.readShort();
+            byteCodeOffset = dataInput.readUnsignedShort();
         } else if (frameType == Const.SAME_FRAME_EXTENDED) {
-            byteCodeOffset = dataInput.readShort();
+            byteCodeOffset = dataInput.readUnsignedShort();
         } else if (frameType >= Const.APPEND_FRAME && frameType <= Const.APPEND_FRAME_MAX) {
-            byteCodeOffset = dataInput.readShort();
+            byteCodeOffset = dataInput.readUnsignedShort();
             final int numberOfLocals = frameType - 251;
             typesOfLocals = new StackMapType[numberOfLocals];
             for (int i = 0; i < numberOfLocals; i++) {
                 typesOfLocals[i] = new StackMapType(dataInput, constantPool);
             }
         } else if (frameType == Const.FULL_FRAME) {
-            byteCodeOffset = dataInput.readShort();
-            final int numberOfLocals = dataInput.readShort();
+            byteCodeOffset = dataInput.readUnsignedShort();
+            final int numberOfLocals = dataInput.readUnsignedShort();
             typesOfLocals = new StackMapType[numberOfLocals];
             for (int i = 0; i < numberOfLocals; i++) {
                 typesOfLocals[i] = new StackMapType(dataInput, constantPool);
             }
-            final int numberOfStackItems = dataInput.readShort();
+            final int numberOfStackItems = dataInput.readUnsignedShort();
             typesOfStackItems = new StackMapType[numberOfStackItems];
             for (int i = 0; i < numberOfStackItems; i++) {
                 typesOfStackItems[i] = new StackMapType(dataInput, constantPool);


[commons-bcel] 03/03: org.apache.bcel.classfile.ConstantInvokeDynamic.ConstantInvokeDynamic(DataInput)

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit 90d3d754879c044c10d6523a27dabc480399c36c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 19 09:29:05 2022 -0500

    org.apache.bcel.classfile.ConstantInvokeDynamic.ConstantInvokeDynamic(DataInput)
---
 src/changes/changes.xml                                            | 1 +
 src/main/java/org/apache/bcel/classfile/ConstantInvokeDynamic.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4c143861..c9491b81 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -89,6 +89,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">Avoid internal NPE in org.apache.bcel.util.ClassPath.getInputStream(String, String).</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.StackMapEntry.StackMapEntry(DataInput, ConstantPool) reads signed instead of unsigned shorts from its DataInput.</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.StackMapType.StackMapType(DataInput, ConstantPool) reads signed instead of unsigned shorts from its DataInput.</action>
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.ConstantInvokeDynamic.ConstantInvokeDynamic(DataInput).</action>
       <!-- UPDATE -->
       <action                  type="update" dev="ggregory" due-to="Gary Gregory">Bump spotbugs-maven-plugin from 4.7.2.2 to 4.7.3.0 #167.</action>
       <action                  type="update" dev="ggregory" due-to="Dependabot">Bump jmh.version from 1.35 to 1.36 #170.</action>
diff --git a/src/main/java/org/apache/bcel/classfile/ConstantInvokeDynamic.java b/src/main/java/org/apache/bcel/classfile/ConstantInvokeDynamic.java
index e17a2ba1..88e6abd5 100644
--- a/src/main/java/org/apache/bcel/classfile/ConstantInvokeDynamic.java
+++ b/src/main/java/org/apache/bcel/classfile/ConstantInvokeDynamic.java
@@ -45,7 +45,7 @@ public final class ConstantInvokeDynamic extends ConstantCP {
      * @throws IOException if an I/O error occurs.
      */
     ConstantInvokeDynamic(final DataInput file) throws IOException {
-        this(file.readShort(), file.readShort());
+        this(file.readUnsignedShort(), file.readUnsignedShort());
     }
 
     public ConstantInvokeDynamic(final int bootstrapMethodAttrIndex, final int nameAndTypeIndex) {