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 57d1a3c6b8555383e17394dcb37f83f03424f208 Author: Gary David Gregory (Code signing key) <[email protected]> AuthorDate: Mon Nov 21 16:22:26 2022 -0500 org.apache.bcel.classfile.ModuleMainClass constructors now throw ClassFormatException on invalid input --- src/changes/changes.xml | 1 + src/main/java/org/apache/bcel/classfile/ModuleMainClass.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index ff0da0b4..a3b45240 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -106,6 +106,7 @@ The <action> type attribute can be add,update,fix,remove. <action type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.LocalVariable constructors now throw ClassFormatException on invalid input.</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.LocalVariableTable constructors now throw ClassFormatException on invalid input.</action> <action type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.LocalVariableTypeTable constructors now throw ClassFormatException on invalid input.</action> + <action type="fix" dev="ggregory" due-to="Gary Gregory">org.apache.bcel.classfile.ModuleMainClass 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/ModuleMainClass.java b/src/main/java/org/apache/bcel/classfile/ModuleMainClass.java index ae4b29c3..aa9686fd 100644 --- a/src/main/java/org/apache/bcel/classfile/ModuleMainClass.java +++ b/src/main/java/org/apache/bcel/classfile/ModuleMainClass.java @@ -22,6 +22,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 indicates the main class of a module. There may be at most one @@ -55,7 +56,7 @@ public final class ModuleMainClass extends Attribute { */ public ModuleMainClass(final int nameIndex, final int length, final int mainClassIndex, final ConstantPool constantPool) { super(Const.ATTR_NEST_MEMBERS, nameIndex, length, constantPool); - this.mainClassIndex = mainClassIndex; + this.mainClassIndex = Args.requireU2(mainClassIndex, "mainClassIndex"); } /**
