From ae0664fd9d534e97cec98c2297972b3452565d27 Mon Sep 17 00:00:00 2001 From: Ned Loynd Date: Wed, 11 Oct 2023 10:44:53 +1100 Subject: [PATCH] Prevent invalid Zopfli iterations --- .../NeRdTheNed/deft4j/util/compression/CompressionUtil.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deft4j-compress/src/main/java/com/github/NeRdTheNed/deft4j/util/compression/CompressionUtil.java b/deft4j-compress/src/main/java/com/github/NeRdTheNed/deft4j/util/compression/CompressionUtil.java index 1ce8c62..2f5c279 100644 --- a/deft4j-compress/src/main/java/com/github/NeRdTheNed/deft4j/util/compression/CompressionUtil.java +++ b/deft4j-compress/src/main/java/com/github/NeRdTheNed/deft4j/util/compression/CompressionUtil.java @@ -41,6 +41,10 @@ public enum Strategy { /** Construct the list of compressors for the given settings */ private static Compressor[] getCompressors(boolean java, boolean jzlib, boolean jzopfli, boolean cafeundzopfli, int iter, Strategy mode, int defaultSplit) { + if (iter < 1) { + iter = 1; + } + final List compressorsList = new ArrayList<>(); if (java) {