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 3e542a8bf [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 3e542a8bf is described below commit 3e542a8bf86ca707b91fb201531f78ed7e173519 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Fri Nov 10 08:50:01 2023 -0500 [COMPRESS-632] LZWInputStream.initializeTables(int) should throw IllegalArgumentException instead of ArrayIndexOutOfBoundsException #435 Apply a different version of PR #435 from Yakov Shafranovich --- .../java/org/apache/commons/compress/compressors/lzw/LZWInputStream.java | 1 + 1 file changed, 1 insertion(+) 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 05455ee06..acaba7711 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,6 +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) { + // TODO test against prefixes.length and characters.length? throw new IllegalArgumentException("maxCodeSize " + maxCodeSize + " is out of bounds."); } final int maxTableSize = 1 << maxCodeSize;