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/21 18:24:54 UTC

[commons-bcel] branch master updated (d3209d93 -> 36cf651d)

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 d3209d93 org.apache.bcel.classfile.CodeException constructors now throw ClassFormatException on invalid input
     new 56859bfc org.apache.bcel.classfile.Code constructors now throw ClassFormatException on invalid input
     new 9bd3c2a7 org.apache.bcel.classfile.Code constructors now throw ClassFormatException on invalid input
     new 36cf651d org.apache.bcel.classfile.ExceptionTable constructors now throw ClassFormatException on invalid input

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                                     | 5 +++--
 src/main/java/org/apache/bcel/classfile/Code.java           | 5 +++--
 src/main/java/org/apache/bcel/classfile/ExceptionTable.java | 2 ++
 3 files changed, 8 insertions(+), 4 deletions(-)


[commons-bcel] 01/03: org.apache.bcel.classfile.Code 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 56859bfc19d24b460102734b79dfd9510f5de89f
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Mon Nov 21 11:17:20 2022 -0500

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

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 9a9f46c2..fec3a5f9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -81,7 +81,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action                  type="fix" dev="ggregory" due-to="nbauma109, Gary Gregory">Code coverage and unit tests on the verifier #166.</action>
       <action                  type="fix" dev="markt" due-to="OSS-Fuzz">References to constant pool entries that are not of the expected type should throw ClassFormatException, not ClassCastException.</action>
       <action                  type="fix" dev="markt" due-to="OSS-Fuzz">When parsing an invalid class, ensure ClassParser.parse() throws ClassFormatException, not IllegalArgumentException.</action>
-      <action                  type="fix" dev="markt" due-to="OSS-Fuzz">Ensure Code attributes with invalid sizes trigger a ClassFormatException.</action>
+      <action                  type="fix" dev="markt" due-to="OSS-Fuzz">org.apache.bcel.classfile.Code constructors now throw ClassFormatException on invalid input.</action>
       <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.Deprecated constructors now throw ClassFormatException on invalid length input.</action>
       <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>
diff --git a/src/main/java/org/apache/bcel/classfile/Code.java b/src/main/java/org/apache/bcel/classfile/Code.java
index 5718f2d2..61997de7 100644
--- a/src/main/java/org/apache/bcel/classfile/Code.java
+++ b/src/main/java/org/apache/bcel/classfile/Code.java
@@ -125,8 +125,8 @@ public final class Code extends Attribute {
     public Code(final int nameIndex, final int length, final int maxStack, final int maxLocals, final byte[] code, final CodeException[] exceptionTable,
         final Attribute[] attributes, final ConstantPool constantPool) {
         super(Const.ATTR_CODE, nameIndex, length, constantPool);
-        this.maxStack = maxStack;
-        this.maxLocals = maxLocals;
+        this.maxStack = Args.requireU2(maxStack, "maxStack");
+        this.maxLocals = Args.requireU2(maxLocals, "maxLocals");
         this.code = code != null ? code : ArrayUtils.EMPTY_BYTE_ARRAY;
         this.exceptionTable = exceptionTable != null ? exceptionTable : CodeException.EMPTY_CODE_EXCEPTION_ARRAY;
         this.attributes = attributes != null ? attributes : EMPTY_ARRAY;


[commons-bcel] 03/03: org.apache.bcel.classfile.ExceptionTable 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 36cf651dbf9670127c36ae926818c4ce9ac03902
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Mon Nov 21 13:24:50 2022 -0500

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

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index fec3a5f9..dde59cbb 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -99,7 +99,8 @@ The <action> type attribute can be add,update,fix,remove.
       <action                  type="fix" dev="markt" due-to="OSS-Fuzz">org.apache.bcel.classfile.StackMapType constructors now throw ClassFormatException on invalid input.</action>
       <action                  type="fix" dev="ggregory" due-to="nbauma109, Gary Gregory">Code coverage and bug fixes for bcelifier #171.</action>
       <action                  type="fix" dev="markt" due-to="Mark Thomas, Gary Gregory">org.apache.bcel.classfile.Attribute constructors now throw ClassFormatException on invalid length input.</action>
-      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.CodeException constructors now throw ClassFormatException on invalid input.</action>      
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.CodeException constructors now throw ClassFormatException on invalid input.</action>
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.ExceptionTable 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>
       <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/ExceptionTable.java b/src/main/java/org/apache/bcel/classfile/ExceptionTable.java
index 7b914e92..82d7fec1 100644
--- a/src/main/java/org/apache/bcel/classfile/ExceptionTable.java
+++ b/src/main/java/org/apache/bcel/classfile/ExceptionTable.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.util.Arrays;
 
 import org.apache.bcel.Const;
+import org.apache.bcel.util.Args;
 import org.apache.commons.lang3.ArrayUtils;
 
 /**
@@ -80,6 +81,7 @@ public final class ExceptionTable extends Attribute {
     public ExceptionTable(final int nameIndex, final int length, final int[] exceptionIndexTable, final ConstantPool constantPool) {
         super(Const.ATTR_EXCEPTIONS, nameIndex, length, constantPool);
         this.exceptionIndexTable = exceptionIndexTable != null ? exceptionIndexTable : ArrayUtils.EMPTY_INT_ARRAY;
+        Args.requireU2(this.exceptionIndexTable.length, "exceptionIndexTable.length");
     }
 
     /**


[commons-bcel] 02/03: org.apache.bcel.classfile.Code 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 9bd3c2a71f80e7790dc1ff86f51f331083689792
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Mon Nov 21 11:33:26 2022 -0500

    org.apache.bcel.classfile.Code constructors now throw
    ClassFormatException on invalid input
---
 src/main/java/org/apache/bcel/classfile/Code.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/main/java/org/apache/bcel/classfile/Code.java b/src/main/java/org/apache/bcel/classfile/Code.java
index 61997de7..e46a2da8 100644
--- a/src/main/java/org/apache/bcel/classfile/Code.java
+++ b/src/main/java/org/apache/bcel/classfile/Code.java
@@ -129,6 +129,7 @@ public final class Code extends Attribute {
         this.maxLocals = Args.requireU2(maxLocals, "maxLocals");
         this.code = code != null ? code : ArrayUtils.EMPTY_BYTE_ARRAY;
         this.exceptionTable = exceptionTable != null ? exceptionTable : CodeException.EMPTY_CODE_EXCEPTION_ARRAY;
+        Args.requireU2(this.exceptionTable.length, "exceptionTable.length");
         this.attributes = attributes != null ? attributes : EMPTY_ARRAY;
         super.setLength(calculateLength()); // Adjust length
     }