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 ac6cfa45e [COMPRESS-632] LZWInputStream.initializeTables(int) should 
throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435
ac6cfa45e is described below

commit ac6cfa45e457227e49d66e4670453abf812e5608
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Nov 10 08:50:57 2023 -0500

    [COMPRESS-632] LZWInputStream.initializeTables(int) should throw
    IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435
    
    Apply a different version of PR #435 from Yakov Shafranovich
---
 .../org/apache/commons/compress/compressors/lzw/LZWInputStream.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java 
b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java
index acaba7711..68c898ea1 100644
--- 
a/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java
@@ -206,7 +206,7 @@ public abstract class LZWInputStream extends 
CompressorInputStream implements In
         if (memoryLimitInKb > -1) {
             final int maxTableSize = 1 << maxCodeSize;
             //account for potential overflow
-            final long memoryUsageInBytes = (long) maxTableSize * 6;//(4 
(prefixes) + 1 (characters) +1 (outputStack))
+            final long memoryUsageInBytes = (long) maxTableSize * 6; //(4 
(prefixes) + 1 (characters) +1 (outputStack))
             final long memoryUsageInKb = memoryUsageInBytes >> 10;
 
             if (memoryUsageInKb > memoryLimitInKb) {

Reply via email to