https://bz.apache.org/bugzilla/show_bug.cgi?id=61575

--- Comment #2 from azad <[email protected]> ---
different way to write coreproperties also provided exception a bit
differently. Use same test file in attachment. First time it is successfully
read/writes and second time gives the exception.

Code:
try {
            InputStream fis = new FileInputStream(fileName);
            XWPFDocument doc = new XWPFDocument(fis);

            CoreProperties cp = doc.getProperties().getCoreProperties();
            cp.setCreator("Test Creator");

            OutputStream fos = new FileOutputStream(fileName);
            doc.write(fos);
            doc.close();
            fos.close();
            fis.close();
        }catch(Exception e){e.printStackTrace();}


Exception:


java.io.IOException: Failed to read zip entry source
        at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:103)
        at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324)
        at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
        at
org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:116)
        at com.sovelia.office.Test.testDocxReadWrite(Test.java:127)
        at com.sovelia.office.Test.main(Test.java:31)
Caused by: 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. Counter: 1326240,
cis.counter: 13253, ratio: 0.009992912293400893Limits: MIN_INFLATE_RATIO: 0.01
        at
org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.advance(ZipSecureFile.java:266)
        at
org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.read(ZipSecureFile.java:221)
        at java.io.FilterInputStream.read(FilterInputStream.java:107)
        at
org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource$FakeZipEntry.<init>(ZipInputStreamZipEntrySource.java:132)
        at
org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.<init>(ZipInputStreamZipEntrySource.java:56)
        at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:100)
        ... 5 more

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to