From dbd2768ca16b3e41f12e7218b1a45aee9310af11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karolis=20Vy=C4=8Dius?= Date: Tue, 2 Jul 2024 12:11:38 +0300 Subject: [PATCH] Increase ZIP_THRESHOLD_SIZE to 100GB (#943) --- .../main/java/com/onthegomap/planetiler/util/FileUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/FileUtils.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/FileUtils.java index 431cc3ddea..ed9286298a 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/FileUtils.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/FileUtils.java @@ -38,7 +38,7 @@ public class FileUtils { private static final Format FORMAT = Format.defaultInstance(); // Prevent zip-bomb attack, see https://rules.sonarsource.com/java/RSPEC-5042 private static final int ZIP_THRESHOLD_ENTRIES = 10_000; - private static final int ZIP_THRESHOLD_SIZE = 1_000_000_000; + private static final long ZIP_THRESHOLD_SIZE = 100_000_000_000L; private static final double ZIP_THRESHOLD_RATIO = 1_000; private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class); @@ -271,7 +271,7 @@ public static void unzipResource(String resource, Path dest) { */ public static void safeCopy(InputStream inputStream, Path destPath) { try (var outputStream = Files.newOutputStream(destPath, StandardOpenOption.CREATE, WRITE)) { - int totalSize = 0; + long totalSize = 0; int nBytes; byte[] buffer = new byte[2048]; @@ -295,7 +295,7 @@ public static void safeCopy(InputStream inputStream, Path destPath) { * @throws UncheckedIOException if an IO exception occurs */ public static void unzip(InputStream input, Path destDir) { - int totalSizeArchive = 0; + long totalSizeArchive = 0; int totalEntryArchive = 0; try (var zip = new ZipInputStream(input)) { ZipEntry entry;