excel-plus icon indicating copy to clipboard operation
excel-plus copied to clipboard

导入excel报错:Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data.

Open yangkebiao opened this issue 5 years ago • 1 comments

Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data. This may indicate that the file is used to inflate memory usage and thus could pose a security risk. You can adjust this limit via ZipSecureFile.setMinInflateRatio() if you need to work with files which exceed this limit. Uncompressed size: 147803, Raw/compressed size: 1462, ratio: 0.009892 Limits: MIN_INFLATE_RATIO: 0.010000, Entry: xl/styles.xml"} java.io.IOException: Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data. This may indicate that the file is used to inflate memory usage and thus could pose a security risk. You can adjust this limit via ZipSecureFile.setMinInflateRatio() if you need to work with files which exceed this limit. Uncompressed size: 147803, Raw/compressed size: 1462, ratio: 0.009892 Limits: MIN_INFLATE_RATIO: 0.010000, Entry: xl/styles.xml at org.apache.poi.openxml4j.util.ZipArchiveThresholdInputStream.checkThreshold(ZipArchiveThresholdInputStream.java:130) at org.apache.poi.openxml4j.util.ZipArchiveThresholdInputStream.read(ZipArchiveThresholdInputStream.java:80) at org.apache.poi.util.IOUtils.toByteArray(IOUtils.java:151) at org.apache.poi.util.IOUtils.toByteArray(IOUtils.java:120) at org.apache.poi.openxml4j.util.ZipArchiveFakeEntry.(ZipArchiveFakeEntry.java:47) at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.(ZipInputStreamZipEntrySource.java:51) at org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:106) at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:299) at org.apache.poi.ooxml.util.PackageHelper.open(PackageHelper.java:37) at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:307)

yangkebiao avatar Dec 20 '19 09:12 yangkebiao

设置了一下ZipSecureFile.setMinInflateRatio(-1.0d);就可以了

yangkebiao avatar Dec 20 '19 09:12 yangkebiao