Skip to content

Commit

Permalink
Increase ZIP_THRESHOLD_SIZE to 100GB (#943)
Browse files Browse the repository at this point in the history
  • Loading branch information
vycius authored Jul 2, 2024
1 parent 09374db commit dbd2768
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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];
Expand All @@ -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;
Expand Down

0 comments on commit dbd2768

Please sign in to comment.