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

commit b8804c974eae232beb9470a3fcb7bcddac32ff2c
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Nov 10 08:49:11 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 6917ccef1..05455ee06 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 
+ ", is out of bounds.");
+            throw new IllegalArgumentException("maxCodeSize " + maxCodeSize + 
" is out of bounds.");
         }
         final int maxTableSize = 1 << maxCodeSize;
         prefixes = new int[maxTableSize];

Reply via email to