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/15 18:45:27 UTC

[commons-bcel] branch master updated (0f599351 -> ff95f518)

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 0f599351 org.apache.bcel.classfile.EnclosingMethod constructors now throw ClassFormatException on invalid length, class index, or method index input.
     new 1036f808 org.apache.bcel.classfile.Synthetic constructors now throw ClassFormatException on invalid length input
     new 9b7d12da Swap args
     new fa0115b1 Javadoc
     new 1d06beda org.apache.bcel.classfile.Signature constructors now throw ClassFormatException on invalid length input
     new ff95f518 org.apache.bcel.classfile.SourceFile constructors now throw ClassFormatException on invalid input

The 5 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 +++
 src/main/java/org/apache/bcel/classfile/ConstantValue.java | 2 +-
 src/main/java/org/apache/bcel/classfile/Signature.java     | 3 ++-
 src/main/java/org/apache/bcel/classfile/SourceFile.java    | 5 +++--
 src/main/java/org/apache/bcel/classfile/Synthetic.java     | 3 ++-
 src/main/java/org/apache/bcel/util/Args.java               | 2 +-
 6 files changed, 12 insertions(+), 6 deletions(-)


[commons-bcel] 02/05: Swap args

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 9b7d12da08226b5ae9455fc5c425b1a1287bee85
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Tue Nov 15 13:36:47 2022 -0500

    Swap args
---
 src/main/java/org/apache/bcel/classfile/ConstantValue.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/bcel/classfile/ConstantValue.java b/src/main/java/org/apache/bcel/classfile/ConstantValue.java
index 580d26c7..dd5188b5 100644
--- a/src/main/java/org/apache/bcel/classfile/ConstantValue.java
+++ b/src/main/java/org/apache/bcel/classfile/ConstantValue.java
@@ -61,7 +61,7 @@ public final class ConstantValue extends Attribute {
      * @param constantPool Array of constants
      */
     public ConstantValue(final int nameIndex, final int length, final int constantValueIndex, final ConstantPool constantPool) {
-        super(Const.ATTR_CONSTANT_VALUE, nameIndex, Args.require(2, length, "ConstantValue attribute length"), constantPool);
+        super(Const.ATTR_CONSTANT_VALUE, nameIndex, Args.require(length, 2, "ConstantValue attribute length"), constantPool);
         this.constantValueIndex = constantValueIndex;
     }
 


[commons-bcel] 03/05: Javadoc

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 fa0115b1d6b2822435325fda5570500c82cd380d
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Tue Nov 15 13:37:01 2022 -0500

    Javadoc
---
 src/main/java/org/apache/bcel/util/Args.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/bcel/util/Args.java b/src/main/java/org/apache/bcel/util/Args.java
index ae654487..186e1909 100644
--- a/src/main/java/org/apache/bcel/util/Args.java
+++ b/src/main/java/org/apache/bcel/util/Args.java
@@ -43,7 +43,7 @@ public class Args {
     }
 
     /**
-     * Requires a non-0 value.
+     * Requires a 0 value.
      *
      * @param value   The value to test.
      * @param message The message prefix


[commons-bcel] 05/05: org.apache.bcel.classfile.SourceFile constructors now throw ClassFormatException on invalid input

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 ff95f51856cbf05207e72abc9fd877fb62872ad8
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Tue Nov 15 13:45:22 2022 -0500

    org.apache.bcel.classfile.SourceFile constructors now throw
    ClassFormatException on invalid input
---
 src/changes/changes.xml                                 | 1 +
 src/main/java/org/apache/bcel/classfile/SourceFile.java | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 63d77e25..72f8b4e3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -79,6 +79,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.EnclosingMethod constructors now throw ClassFormatException on invalid length, class index, or method index input.</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.Synthetic constructors now throw ClassFormatException on invalid length input.</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.Signature constructors now throw ClassFormatException on invalid length input.</action>
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.SourceFile constructors now throw ClassFormatException on invalid input.</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>
     </release>
diff --git a/src/main/java/org/apache/bcel/classfile/SourceFile.java b/src/main/java/org/apache/bcel/classfile/SourceFile.java
index 0b46b213..1ac137c1 100644
--- a/src/main/java/org/apache/bcel/classfile/SourceFile.java
+++ b/src/main/java/org/apache/bcel/classfile/SourceFile.java
@@ -21,6 +21,7 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.apache.bcel.Const;
+import org.apache.bcel.util.Args;
 
 /**
  * This class is derived from <em>Attribute</em> and represents a reference to the source file of this class. At most
@@ -56,8 +57,8 @@ public final class SourceFile extends Attribute {
      *        in many cases, the JVM.
      */
     public SourceFile(final int nameIndex, final int length, final int sourceFileIndex, final ConstantPool constantPool) {
-        super(Const.ATTR_SOURCE_FILE, nameIndex, length, constantPool);
-        this.sourceFileIndex = sourceFileIndex;
+        super(Const.ATTR_SOURCE_FILE, nameIndex, Args.require(length, 2, "SourceFile length attribute"), constantPool);
+        this.sourceFileIndex = Args.requireU2(sourceFileIndex, 0, constantPool.getLength(), "SourceFile source file index");
     }
 
     /**


[commons-bcel] 04/05: org.apache.bcel.classfile.Signature constructors now throw ClassFormatException on invalid length input

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 1d06bedaa613894a3420ccdb59ae2e4819f40975
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Tue Nov 15 13:37:25 2022 -0500

    org.apache.bcel.classfile.Signature constructors now throw
    ClassFormatException on invalid length input
---
 src/changes/changes.xml                                | 1 +
 src/main/java/org/apache/bcel/classfile/Signature.java | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 364de329..63d77e25 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -78,6 +78,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.ConstantValue constructors now throw ClassFormatException on invalid length input.</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.EnclosingMethod constructors now throw ClassFormatException on invalid length, class index, or method index input.</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.Synthetic constructors now throw ClassFormatException on invalid length input.</action>
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.Signature constructors now throw ClassFormatException on invalid length input.</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>
     </release>
diff --git a/src/main/java/org/apache/bcel/classfile/Signature.java b/src/main/java/org/apache/bcel/classfile/Signature.java
index b2d71e1e..b8c51ad7 100644
--- a/src/main/java/org/apache/bcel/classfile/Signature.java
+++ b/src/main/java/org/apache/bcel/classfile/Signature.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 
 import org.apache.bcel.Const;
+import org.apache.bcel.util.Args;
 
 /**
  * This class is derived from <em>Attribute</em> and represents a reference to a GJ attribute.
@@ -172,7 +173,7 @@ public final class Signature extends Attribute {
      * @param constantPool Array of constants
      */
     public Signature(final int nameIndex, final int length, final int signatureIndex, final ConstantPool constantPool) {
-        super(Const.ATTR_SIGNATURE, nameIndex, length, constantPool);
+        super(Const.ATTR_SIGNATURE, nameIndex, Args.require(length, 2, "Signature length attribute"), constantPool);
         this.signatureIndex = signatureIndex;
     }
 


[commons-bcel] 01/05: org.apache.bcel.classfile.Synthetic constructors now throw ClassFormatException on invalid length input

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 1036f80887c28eeeb5deebbf10aba9c1630a2bc4
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Tue Nov 15 13:36:27 2022 -0500

    org.apache.bcel.classfile.Synthetic constructors now throw
    ClassFormatException on invalid length input
---
 src/changes/changes.xml                                | 1 +
 src/main/java/org/apache/bcel/classfile/Synthetic.java | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4d8cbd37..364de329 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -77,6 +77,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.Attribute constructors now throw ClassFormatException on invalid name index input.</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.ConstantValue constructors now throw ClassFormatException on invalid length input.</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.EnclosingMethod constructors now throw ClassFormatException on invalid length, class index, or method index input.</action>
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.Synthetic constructors now throw ClassFormatException on invalid length input.</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>
     </release>
diff --git a/src/main/java/org/apache/bcel/classfile/Synthetic.java b/src/main/java/org/apache/bcel/classfile/Synthetic.java
index 41b414dd..ab7a1d17 100644
--- a/src/main/java/org/apache/bcel/classfile/Synthetic.java
+++ b/src/main/java/org/apache/bcel/classfile/Synthetic.java
@@ -21,6 +21,7 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 
 import org.apache.bcel.Const;
+import org.apache.bcel.util.Args;
 
 /**
  * This class is derived from <em>Attribute</em> and declares this class as `synthetic', i.e., it needs special
@@ -41,7 +42,7 @@ public final class Synthetic extends Attribute {
      * @param constantPool The constant pool this attribute is associated with.
      */
     public Synthetic(final int nameIndex, final int length, final byte[] bytes, final ConstantPool constantPool) {
-        super(Const.ATTR_SYNTHETIC, nameIndex, length, constantPool);
+        super(Const.ATTR_SYNTHETIC, nameIndex, Args.require0(length, "Synthetic attribute length"), constantPool);
         this.bytes = bytes;
     }