You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2026/10/22 11:22:27 UTC

(poi) branch trunk updated (e3192f894c -> 5d14e09d7d)

This is an automated email from the ASF dual-hosted git repository.

centic9 pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git


    from e3192f894c Add README and dependencies to run fuzzing locally
     new 6decd3b4df Add dedicated fuzzer for XSSFBEventBasedExcelExtractor
     new 5d14e09d7d Fuzzing: Expect ArithmeticException and NPE in commons-compress in more places

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 poi-fuzz/README.md                                 |  6 +++
 .../main/java/org/apache/poi/fuzz/POIFuzzer.java   | 12 +++++-
 .../java/org/apache/poi/fuzz/POIHSLFFuzzer.java    |  3 +-
 .../{POIXSSFFuzzer.java => POIXSSFBFuzzer.java}    | 47 ++++++++++------------
 4 files changed, 40 insertions(+), 28 deletions(-)
 copy poi-fuzz/src/main/java/org/apache/poi/fuzz/{POIXSSFFuzzer.java => POIXSSFBFuzzer.java} (64%)


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


(poi) 01/02: Add dedicated fuzzer for XSSFBEventBasedExcelExtractor

Posted by ce...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

centic9 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git

commit 6decd3b4df67bcb4c7716286c7c5b002d35e2f56
Author: Dominik Stadler <do...@gmx.at>
AuthorDate: Thu Oct 22 12:10:54 2026 +0200

    Add dedicated fuzzer for XSSFBEventBasedExcelExtractor
    
    To try to cover this area some more as the
    general text-extraction does not reach this
    area currently
---
 poi-fuzz/README.md                                 |  6 +++
 .../main/java/org/apache/poi/fuzz/POIFuzzer.java   |  2 +
 .../java/org/apache/poi/fuzz/POIXSSFBFuzzer.java   | 63 ++++++++++++++++++++++
 3 files changed, 71 insertions(+)

diff --git a/poi-fuzz/README.md b/poi-fuzz/README.md
index 9de802fcf7..d4779aa05f 100644
--- a/poi-fuzz/README.md
+++ b/poi-fuzz/README.md
@@ -101,6 +101,12 @@ or allows to run it in a container-based infrastructure.
     cp corpus/spreadsheet/* corpus/integration/*.xlsx corpusXSSF/
     ../gradlew shadowJar && ./jazzer --cp=build/libs/poi-fuzz-6.0.0-all.jar "--instrumentation_includes=org.apache.poi.**:org.apache.xmlbeans.**" --target_class=org.apache.poi.fuzz.POIXSSFFuzzer -rss_limit_mb=2560 corpusXSSF
 
+## XSSFB
+
+    mkdir corpusXSSFB
+    cp corpus/spreadsheet/*.xlsb corpusXSSFB/
+    ../gradlew shadowJar && ./jazzer --cp=build/libs/poi-fuzz-6.0.0-all.jar "--instrumentation_includes=org.apache.poi.**:org.apache.xmlbeans.**" --target_class=org.apache.poi.fuzz.POIXSSFBFuzzer -rss_limit_mb=2560 corpusXSSFB
+
 ## XLSX2CSV
 
 Can re-use XSSF-corpus as the same files are processed here
diff --git a/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIFuzzer.java b/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIFuzzer.java
index 646cd27485..6bb3773a4e 100644
--- a/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIFuzzer.java
+++ b/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIFuzzer.java
@@ -90,6 +90,8 @@ public class POIFuzzer {
 
 		POIXSSFFuzzer.fuzzerTestOneInput(input);
 
+		POIXSSFBFuzzer.fuzzerTestOneInput(input);
+
 		POIXWPFFuzzer.fuzzerTestOneInput(input);
 	}
 
diff --git a/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIXSSFBFuzzer.java b/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIXSSFBFuzzer.java
new file mode 100644
index 0000000000..89d8fccc1d
--- /dev/null
+++ b/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIXSSFBFuzzer.java
@@ -0,0 +1,63 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.fuzz;
+
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.apache.poi.ooxml.POIXMLException;
+import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
+import org.apache.poi.openxml4j.opc.OPCPackage;
+import org.apache.poi.util.RecordFormatException;
+import org.apache.poi.xssf.binary.XSSFBParseException;
+import org.apache.poi.xssf.extractor.XSSFBEventBasedExcelExtractor;
+import org.apache.xmlbeans.XmlException;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+public class POIXSSFBFuzzer {
+	public static void fuzzerInitialize() {
+		POIFuzzer.adjustLimits();
+	}
+
+	public static void fuzzerTestOneInput(byte[] input) {
+		if (input.length == 0) {
+			return;
+		}
+
+		try (OPCPackage pkg = OPCPackage.open(new ByteArrayInputStream(input), true)) {
+			XSSFBEventBasedExcelExtractor ex = new XSSFBEventBasedExcelExtractor(pkg);
+			ex.getText();
+
+			/* Not supported:
+			ex.setFormulasNotResults(true);
+			ex.getText();*/
+
+			ex.setHandleHyperlinksInCells(true);
+			ex.getText();
+		} catch (IOException | XmlException | OpenXML4JException | POIXMLException |
+                 RecordFormatException | IndexOutOfBoundsException | IllegalArgumentException |
+				 IllegalStateException | ArithmeticException | XSSFBParseException ex) {
+			// expected
+		} catch (NullPointerException e) {
+			// can be removed when commons-compress is > 1.28.0 and changes from COMPRESS-598 are applied
+			if (!ExceptionUtils.getStackTrace(e).contains("org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read")) {
+				throw e;
+			}
+        }
+	}
+}


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


(poi) 02/02: Fuzzing: Expect ArithmeticException and NPE in commons-compress in more places

Posted by ce...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

centic9 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git

commit 5d14e09d7d074ea0e0a633c59414dc6314fc19c1
Author: Dominik Stadler <do...@gmx.at>
AuthorDate: Thu Oct 22 13:06:46 2026 +0200

    Fuzzing: Expect ArithmeticException and NPE in commons-compress in more places
    
    Also fixes https://issues.oss-fuzz.com/issues/520018227
---
 poi-fuzz/src/main/java/org/apache/poi/fuzz/POIFuzzer.java     | 10 ++++++++--
 poi-fuzz/src/main/java/org/apache/poi/fuzz/POIHSLFFuzzer.java |  3 ++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIFuzzer.java b/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIFuzzer.java
index 6bb3773a4e..3318458eff 100644
--- a/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIFuzzer.java
+++ b/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIFuzzer.java
@@ -23,6 +23,7 @@ import java.nio.BufferUnderflowException;
 import java.util.NoSuchElementException;
 
 import org.apache.commons.io.output.NullOutputStream;
+import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.core.config.AbstractConfiguration;
 import org.apache.poi.ddf.EscherRecord;
@@ -113,6 +114,11 @@ public class POIFuzzer {
 				UnsupportedOperationException | NoSuchElementException | NegativeArraySizeException |
 				ArithmeticException e) {
 			// expected here
+		} catch (NullPointerException e) {
+			// can be removed when commons-compress is > 1.28.0 and changes from COMPRESS-598 are applied
+			if (!ExceptionUtils.getStackTrace(e).contains("org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read")) {
+				throw e;
+			}
 		}
 
 		ExtractorFactory.setThreadPrefersEventExtractors(true);
@@ -150,7 +156,7 @@ public class POIFuzzer {
 		}
 
 		if (extractor instanceof POIOLE2TextExtractor ole2Extractor) {
-            ole2Extractor.getRoot();
+			ole2Extractor.getRoot();
 			ole2Extractor.getSummaryInformation();
 			ole2Extractor.getDocSummaryInformation();
 
@@ -164,7 +170,7 @@ public class POIFuzzer {
 				metaData.getText();
 			}
 		} else if (extractor instanceof POIXMLTextExtractor xmlExtractor) {
-            xmlExtractor.getCoreProperties();
+			xmlExtractor.getCoreProperties();
 			xmlExtractor.getCustomProperties();
 			xmlExtractor.getExtendedProperties();
 			POIXMLPropertiesTextExtractor metaData = xmlExtractor.getMetadataTextExtractor();
diff --git a/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIHSLFFuzzer.java b/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIHSLFFuzzer.java
index a70c36faf9..4cca095fc4 100644
--- a/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIHSLFFuzzer.java
+++ b/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIHSLFFuzzer.java
@@ -66,7 +66,8 @@ public class POIHSLFFuzzer {
 			}
 		} catch (IOException | IllegalArgumentException | RecordFormatException |
 				 IllegalStateException | HSLFException | IndexOutOfBoundsException |
-				 BufferUnderflowException | POIXMLException | NoSuchElementException e) {
+				 BufferUnderflowException | POIXMLException | NoSuchElementException |
+				 ArithmeticException e) {
 			// expected here
 		}
 	}


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