+ final var size = entry.getSize();
+ totalEntryArchive++;
+ totalSizeEntry += size;
+ if (totalSizeEntry > THRESHOLD_SIZE || size == -1) {
+ throw new IllegalStateException("File to be unzipped too big.");
+ }
+
+ final long compressionRatio = totalSizeEntry / entry.getCompressedSize();
+ if (compressionRatio > THRESHOLD_RATIO) {
+ return Single.error(new Exception("Wrong file type, threshold to high."));
+ }
+
+ if (totalEntryArchive > THRESHOLD_ENTRIES) {
+ // too much entries in this archive, can lead to inodes exhaustion of the system
+ return Single.error(new Exception("Too many files"));
+ }
+