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) <ggreg...@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;

Reply via email to