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/27 23:04:27 UTC

[commons-bcel] 02/02: Fix possible NullPointerException in org.apache.bcel.classfile.StackMap.setStackMap(StackMapEntry[])

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 2eb9736750fb884db269e7e52533295074830074
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Nov 27 18:04:21 2022 -0500

    Fix possible NullPointerException in
    org.apache.bcel.classfile.StackMap.setStackMap(StackMapEntry[])
---
 src/changes/changes.xml                               | 1 +
 src/main/java/org/apache/bcel/classfile/StackMap.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index aab0029b..7c4c9eec 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -114,6 +114,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action                  type="fix" dev="markt" due-to="OSS-Fuzz">When parsing class files, limit arrays to no more than 255 dimensions as per section 4.4.1 of the JVM specification.</action>
       <action                  type="fix" dev="ggregory" due-to="nbauma109">Tests and coverage for Utility class #175.</action>
       <action                  type="fix" dev="ggregory" due-to="nbauma109">Unit tests and coverage for binary operations #174.</action>
+      <action                  type="fix" dev="ggregory" due-to="Gary Gregory">Fix possible NullPointerException in org.apache.bcel.classfile.StackMap.setStackMap(StackMapEntry[]).</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/StackMap.java b/src/main/java/org/apache/bcel/classfile/StackMap.java
index 80f2d2a7..40df561d 100644
--- a/src/main/java/org/apache/bcel/classfile/StackMap.java
+++ b/src/main/java/org/apache/bcel/classfile/StackMap.java
@@ -135,7 +135,7 @@ public final class StackMap extends Attribute {
     public void setStackMap(final StackMapEntry[] table) {
         this.table = table != null ? table : StackMapEntry.EMPTY_ARRAY;
         int len = 2; // Length of 'number_of_entries' field prior to the array of stack maps
-        for (final StackMapEntry element : table) {
+        for (final StackMapEntry element : this.table) {
             len += element.getMapEntrySize();
         }
         setLength(len);