poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1722407 - in /poi/trunk: src/integrationtest/org/apache/poi/ src/java/org/apache/poi/poifs/crypt/standard/ src/ooxml/testcases/org/apache/poi/poifs/crypt/ test-data/spreadsheet/
Date Wed, 30 Dec 2015 20:31:24 GMT
Author: centic
Date: Wed Dec 30 20:31:23 2015
New Revision: 1722407

URL: http://svn.apache.org/viewvc?rev=1722407&view=rev
Log:
Bug 58616: Try to initialize with empty password if not done before

Added:
    poi/trunk/test-data/spreadsheet/58616.xlsx
Modified:
    poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java

Modified: poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java?rev=1722407&r1=1722406&r2=1722407&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java Wed Dec 30 20:31:23 2015
@@ -199,6 +199,7 @@ public class TestAllFiles {
         //EXPECTED_FAILURES.add("poifs/protected_sha512.xlsx");
         //EXPECTED_FAILURES.add("poifs/extenxls_pwd123.xlsx");
         //EXPECTED_FAILURES.add("poifs/protected_agile.docx");
+        EXPECTED_FAILURES.add("spreadsheet/58616.xlsx");
 
         // TODO: fails XMLExportTest, is this ok?
         EXPECTED_FAILURES.add("spreadsheet/CustomXMLMapping-singleattributenamespace.xlsx");

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java?rev=1722407&r1=1722406&r2=1722407&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/standard/StandardDecryptor.java Wed Dec
30 20:31:23 2015
@@ -127,6 +127,9 @@ public class StandardDecryptor extends D
 
         _length = dis.readLong();
 
+        if(getSecretKey() == null) {
+            verifyPassword(null);
+        }
         // limit wrong calculated ole entries - (bug #57080)
         // standard encryption always uses aes encoding, so blockSize is always 16 
         // http://stackoverflow.com/questions/3283787/size-of-data-after-aes-encryption

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java?rev=1722407&r1=1722406&r2=1722407&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java Wed Dec 30
20:31:23 2015
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertTru
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.security.GeneralSecurityException;
@@ -33,6 +34,7 @@ import org.apache.poi.poifs.filesystem.D
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.IOUtils;
+import org.apache.poi.xssf.XSSFTestDataSamples;
 import org.junit.Test;
 
 /**
@@ -151,4 +153,13 @@ public class TestDecryptor {
         zis.close();
         fs.close();
     }
+
+    @Test
+    public void test58616() throws IOException, GeneralSecurityException {
+        POIFSFileSystem pfs = new POIFSFileSystem(new FileInputStream(XSSFTestDataSamples.getSampleFile("58616.xlsx")));
               
+        EncryptionInfo info = new EncryptionInfo(pfs);             
+        Decryptor dec = Decryptor.getInstance(info);   
+        //dec.verifyPassword(null);
+        dec.getDataStream(pfs);
+    }
 }
\ No newline at end of file

Added: poi/trunk/test-data/spreadsheet/58616.xlsx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/58616.xlsx?rev=1722407&view=auto
==============================================================================
Binary files poi/trunk/test-data/spreadsheet/58616.xlsx (added) and poi/trunk/test-data/spreadsheet/58616.xlsx
Wed Dec 30 20:31:23 2015 differ



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message