This is an automated email from the ASF dual-hosted git repository. centic9 pushed a commit to branch improve_fuzzing_and_avoid_some_npes in repository https://gitbox.apache.org/repos/asf/poi.git
commit 23a624d87713c383d47ffc36f820024b341b78d2 Author: Dominik Stadler <[email protected]> AuthorDate: Thu Oct 29 20:08:11 2026 +0100 Fuzzing: Adjust fuzzing of the XSSFB handler --- .../src/main/java/org/apache/poi/fuzz/POIXSSFBFuzzer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 index 9d7befc9f4..5614e0efe6 100644 --- a/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIXSSFBFuzzer.java +++ b/poi-fuzz/src/main/java/org/apache/poi/fuzz/POIXSSFBFuzzer.java @@ -17,6 +17,7 @@ package org.apache.poi.fuzz; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.poi.ooxml.POIXMLException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException; @@ -25,8 +26,8 @@ import org.apache.poi.openxml4j.exceptions.PartAlreadyExistsException; 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.eventusermodel.XSSFBReader; import org.apache.poi.xssf.extractor.XSSFBEventBasedExcelExtractor; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.xmlbeans.XmlException; import java.io.ByteArrayInputStream; @@ -45,11 +46,11 @@ public class POIXSSFBFuzzer { try (OPCPackage pkg = OPCPackage.open(new ByteArrayInputStream(input), true)) { // use separate try-catch to try both things even if the first one fails try { - new XSSFWorkbook(pkg).close(); + new XSSFBReader(pkg); } catch (IOException | POIXMLException | - RecordFormatException | IndexOutOfBoundsException | IllegalArgumentException | - IllegalStateException | ArithmeticException | XSSFBParseException | - PartAlreadyExistsException e) { + RecordFormatException | IndexOutOfBoundsException | IllegalArgumentException | + IllegalStateException | ArithmeticException | XSSFBParseException | + PartAlreadyExistsException | OpenXML4JException e) { // expected } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
