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:28 UTC
[commons-bcel] 01/05: org.apache.bcel.classfile.Synthetic constructors now throw ClassFormatException on invalid length input
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;
}