diff options
-rw-r--r-- | poi-integration/src/test/java/org/apache/poi/stress/AbstractFileHandler.java | 29 | ||||
-rw-r--r-- | poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java | 4 | ||||
-rw-r--r-- | poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java | 1 | ||||
-rw-r--r-- | poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java | 1 | ||||
-rw-r--r-- | test-data/spreadsheet/clusterfuzz-testcase-minimized-POIHSSFFuzzer-5175219985448960.xls | bin | 0 -> 27053 bytes | |||
-rw-r--r-- | test-data/spreadsheet/stress.xls | bin | 61952 -> 61952 bytes |
6 files changed, 33 insertions, 2 deletions
diff --git a/poi-integration/src/test/java/org/apache/poi/stress/AbstractFileHandler.java b/poi-integration/src/test/java/org/apache/poi/stress/AbstractFileHandler.java index c413fb0733..c1c96aaa12 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/AbstractFileHandler.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/AbstractFileHandler.java @@ -109,13 +109,38 @@ public abstract class AbstractFileHandler implements FileHandler { assertEquals(modified, file.lastModified(), "File should not be modified by extractor"); if (extractor instanceof POIOLE2TextExtractor) { - try (HPSFPropertiesExtractor hpsfExtractor = new HPSFPropertiesExtractor((POIOLE2TextExtractor) extractor)) { + POIOLE2TextExtractor ole2Extractor = (POIOLE2TextExtractor) extractor; + ole2Extractor.getRoot(); + if (!(ole2Extractor instanceof EventBasedExcelExtractor)) { + ole2Extractor.getSummaryInformation(); + ole2Extractor.getDocSummaryInformation(); + } + + try (HPSFPropertiesExtractor hpsfExtractor = new HPSFPropertiesExtractor(ole2Extractor)) { assertNotNull(hpsfExtractor.getDocumentSummaryInformationText()); assertNotNull(hpsfExtractor.getSummaryInformationText()); String text = hpsfExtractor.getText(); //System.out.println(text); assertNotNull(text); } + + if (ole2Extractor.getRoot() != null && !Boolean.getBoolean("scratchpad.ignore")) { + POITextExtractor[] embedded = ExtractorFactory.getEmbeddedDocsTextExtractors(ole2Extractor); + try { + for (POITextExtractor poiTextExtractor : embedded) { + poiTextExtractor.getText(); + poiTextExtractor.getDocument(); + poiTextExtractor.getFilesystem(); + POITextExtractor metaData = poiTextExtractor.getMetadataTextExtractor(); + metaData.getFilesystem(); + metaData.getText(); + } + } finally { + for (POITextExtractor embeddedExtractor : embedded) { + embeddedExtractor.close(); + } + } + } } // test again with including formulas and cell-comments as this caused some bugs @@ -166,6 +191,8 @@ public abstract class AbstractFileHandler implements FileHandler { assertNotNull(streamExtractor); assertNotNull(streamExtractor.getText()); + + assertNotNull(streamExtractor.getMetadataTextExtractor()); } } } diff --git a/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java b/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java index 21e61e572a..f784842274 100644 --- a/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java +++ b/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java @@ -373,7 +373,9 @@ public final class ExtractorFactory { ArrayList<POITextExtractor> textExtractors = new ArrayList<>(); for (Entry dir : dirs) { - textExtractors.add(createExtractor((DirectoryNode) dir)); + if (dir instanceof DirectoryNode) { + textExtractors.add(createExtractor((DirectoryNode) dir)); + } } for (InputStream stream : nonPOIFS) { try { diff --git a/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java b/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java index 218ecb93f6..4655517e08 100644 --- a/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java +++ b/poi/src/test/java/org/apache/poi/hssf/dev/TestBiffViewer.java @@ -44,6 +44,7 @@ class TestBiffViewer extends BaseTestIteratingXLS { excludes.put("protected_66115.xls", RecordFormatException.class); excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5786329142919168.xls", IllegalStateException.class); excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5889658057523200.xls", IndexOutOfBoundsException.class); + excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5175219985448960.xls", IndexOutOfBoundsException.class); return excludes; } diff --git a/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java b/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java index 7f2f85dcbb..c04d994a43 100644 --- a/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java +++ b/poi/src/test/java/org/apache/poi/hssf/dev/TestRecordLister.java @@ -47,6 +47,7 @@ class TestRecordLister extends BaseTestIteratingXLS { Map<String, Class<? extends Throwable>> excludes = super.getExcludes(); excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5786329142919168.xls", RecordFormatException.class); excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5889658057523200.xls", IndexOutOfBoundsException.class); + excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5175219985448960.xls", RecordFormatException.class); return excludes; } diff --git a/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIHSSFFuzzer-5175219985448960.xls b/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIHSSFFuzzer-5175219985448960.xls Binary files differnew file mode 100644 index 0000000000..8a982d7961 --- /dev/null +++ b/test-data/spreadsheet/clusterfuzz-testcase-minimized-POIHSSFFuzzer-5175219985448960.xls diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls Binary files differindex 31a8b184cd..275bc91d8e 100644 --- a/test-data/spreadsheet/stress.xls +++ b/test-data/spreadsheet/stress.xls |