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

commit 787f44c83e84e308c174c46a3c4017326fe7f8f3
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Nov 10 08:48:51 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 b51e4b47a..6917ccef1 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
@@ -172,7 +172,7 @@ public abstract class LZWInputStream extends 
CompressorInputStream implements In
         // maxCodeSize shifted cannot be less than 256, otherwise the loop in 
initializeTables() will throw an ArrayIndexOutOfBoundsException
         // maxCodeSize cannot be smaller than getCodeSize(), otherwise 
addEntry() will throw an ArrayIndexOutOfBoundsException
         if (1 << maxCodeSize < 256 || getCodeSize() > maxCodeSize) {
-            throw new IllegalArgumentException("maxCodeSize is " + maxCodeSize 
+ ", must be bigger than 0");
+            throw new IllegalArgumentException("maxCodeSize is " + maxCodeSize 
+ ", is out of bounds.");
         }
         final int maxTableSize = 1 << maxCodeSize;
         prefixes = new int[maxTableSize];

Reply via email to