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-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new d4bdb6c51 Better memory guard
d4bdb6c51 is described below

commit d4bdb6c51df2e046c5678d0feff0db8f86a3bf13
Author: Gary D. Gregory <[email protected]>
AuthorDate: Wed Aug 20 08:53:25 2025 -0400

    Better memory guard
---
 .../compress/harmony/unpack200/bytecode/forms/LookupSwitchForm.java   | 2 +-
 .../compress/harmony/unpack200/bytecode/forms/TableSwitchForm.java    | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/LookupSwitchForm.java
 
b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/LookupSwitchForm.java
index 1adbbc088..67dd61ec1 100644
--- 
a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/LookupSwitchForm.java
+++ 
b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/LookupSwitchForm.java
@@ -46,7 +46,7 @@ public void setByteCodeOperands(final ByteCode byteCode, 
final OperandManager op
         final int caseCount = operandManager.nextCaseCount();
         final int defaultPc = operandManager.nextLabel();
         // Check all at once here for all arrays in this method to account for 
failures seen in GH CI.
-        Pack200Exception.checkIntArray(caseCount * 5); // yeah, might overflow.
+        Pack200Exception.checkIntArray(caseCount * 8); // yeah, might overflow.
         final int[] caseValues = new 
int[Pack200Exception.checkIntArray(caseCount)];
         Arrays.setAll(caseValues, i -> operandManager.nextCaseValues());
         final int[] casePcs = new 
int[Pack200Exception.checkIntArray(caseCount)];
diff --git 
a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/TableSwitchForm.java
 
b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/TableSwitchForm.java
index 9f15175c6..87491e9f1 100644
--- 
a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/TableSwitchForm.java
+++ 
b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/forms/TableSwitchForm.java
@@ -52,6 +52,8 @@ public void setByteCodeOperands(final ByteCode byteCode, 
final OperandManager op
         final int caseCount = operandManager.nextCaseCount();
         final int defaultPc = operandManager.nextLabel();
         final int caseValue = operandManager.nextCaseValues();
+        // Check all at once here for all arrays in this method to account for 
failures seen in GH CI.
+        Pack200Exception.checkIntArray(caseCount * 6); // yeah, might overflow.
         final int[] casePcs = new 
int[Pack200Exception.checkIntArray(caseCount)];
         Arrays.setAll(casePcs, i -> operandManager.nextLabel());
         final int[] labelsArray = new 
int[Pack200Exception.checkIntArray(caseCount + 1)];
@@ -99,7 +101,7 @@ public void setByteCodeOperands(final ByteCode byteCode, 
final OperandManager op
         rewriteIndex += 4;
         // jump offsets
         // The case_pcs will get overwritten by fixUpByteCodeTargets
-        Arrays.fill(newRewrite, rewriteIndex, rewriteIndex + (caseCount * 4), 
-1);
+        Arrays.fill(newRewrite, rewriteIndex, rewriteIndex + caseCount * 4, 
-1);
         byteCode.setRewrite(newRewrite);
     }
 }

Reply via email to