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 15:57:12 UTC

[commons-bcel] branch master updated: org.apache.bcel.classfile.Deprecated 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


The following commit(s) were added to refs/heads/master by this push:
     new 51b64d6b org.apache.bcel.classfile.Deprecated constructors now throw ClassFormatException on invalid length input
51b64d6b is described below

commit 51b64d6b13e5e0ef7978e1cde970c5be0c8ee3c3
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Tue Nov 15 10:57:07 2022 -0500

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

diff --git a/src/main/java/org/apache/bcel/classfile/Deprecated.java b/src/main/java/org/apache/bcel/classfile/Deprecated.java
index 79f111e9..45f4f721 100644
--- a/src/main/java/org/apache/bcel/classfile/Deprecated.java
+++ b/src/main/java/org/apache/bcel/classfile/Deprecated.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 denotes that this is a deprecated method. It is instantiated from
@@ -47,7 +48,7 @@ public final class Deprecated extends Attribute {
      * @param constantPool Array of constants
      */
     public Deprecated(final int nameIndex, final int length, final byte[] bytes, final ConstantPool constantPool) {
-        super(Const.ATTR_DEPRECATED, nameIndex, length, constantPool);
+        super(Const.ATTR_DEPRECATED, nameIndex, Args.require0(length, "Invalid Deprecated attribute length"), constantPool);
         this.bytes = bytes;
     }