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 b171524df SevenZFile now throws MemoryLimitException instead of other 
Throwables
b171524df is described below

commit b171524dfb226ddc92a9595449421a36659a416c
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Aug 16 15:51:45 2025 -0400

    SevenZFile now throws MemoryLimitException instead of other Throwables
---
 .../org/apache/commons/compress/archivers/sevenz/SevenZFile.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java 
b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
index 9f48a62ee..79f24d4bd 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
@@ -1346,7 +1346,7 @@ private void readFilesInfo(final ByteBuffer header, final 
Archive archive) throw
             case NID.kName: {
                 /* final int external = */ getUnsignedByte(header);
                 MemoryLimitException.checkKiB(bytesToKiB(size - 1), 
maxMemoryLimitKiB);
-                final byte[] names = new byte[ArchiveException.toIntExact(size 
- 1)];
+                final byte[] names = new 
byte[checkByteArray(ArchiveException.toIntExact(size - 1))];
                 final int namesLength = names.length;
                 get(header, names);
                 int nextFile = 0;
@@ -1465,7 +1465,7 @@ private void readFilesInfo(final ByteBuffer header, final 
Archive archive) throw
     private Folder readFolder(final ByteBuffer header) throws IOException {
         final Folder folder = new Folder();
         final int numCoders = readUint64ToIntExact(header);
-        final Coder[] coders = new Coder[numCoders];
+        final Coder[] coders = new Coder[checkObjectArray(numCoders)];
         long totalInStreams = 0;
         long totalOutStreams = 0;
         for (int i = 0; i < coders.length; i++) {
@@ -1743,7 +1743,7 @@ private void readSubStreamsInfo(final ByteBuffer header, 
final Archive archive)
     private void readUnpackInfo(final ByteBuffer header, final Archive 
archive) throws IOException {
         int nid = getUnsignedByte(header);
         final int numFoldersInt = readUint64ToIntExact(header);
-        final Folder[] folders = new Folder[numFoldersInt];
+        final Folder[] folders = new Folder[checkObjectArray(numFoldersInt)];
         archive.folders = folders;
         /* final int external = */ getUnsignedByte(header);
         for (int i = 0; i < numFoldersInt; i++) {

Reply via email to