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 fc492fae637d25e2da31edba61abf415242c1701 Author: Dominik Stadler <[email protected]> AuthorDate: Sun Mar 8 17:12:55 2026 +0100 Avoid NPE when caching tables by name --- .../xssf/usermodel/BaseXSSFEvaluationWorkbook.java | 7 +++++-- test-data/poi-integration-exceptions.csv | 3 ++- test-data/spreadsheet/LIBRE_OFFICE-128382-0.xlsx | Bin 0 -> 1839194 bytes 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java index 5cafcea7f0..5621863c8b 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/BaseXSSFEvaluationWorkbook.java @@ -275,7 +275,7 @@ public abstract class BaseXSSFEvaluationWorkbook implements FormulaRenderingWork @Override public String resolveNameXText(NameXPtg n) { int idx = n.getNameIndex(); - String name = null; + String name; // First, try to find it as a User Defined Function IndexedUDFFinder udfFinder = (IndexedUDFFinder)getUDFFinder(); @@ -369,7 +369,10 @@ public abstract class BaseXSSFEvaluationWorkbook implements FormulaRenderingWork for (Sheet sheet : _uBook) { for (XSSFTable tbl : ((XSSFSheet)sheet).getTables()) { - _tableCache.put(tbl.getName(), tbl); + String name = tbl.getName(); + if (name != null) { + _tableCache.put(name, tbl); + } } } return _tableCache; diff --git a/test-data/poi-integration-exceptions.csv b/test-data/poi-integration-exceptions.csv index 39b9bbf3f2..ca54ad9323 100644 --- a/test-data/poi-integration-exceptions.csv +++ b/test-data/poi-integration-exceptions.csv @@ -405,4 +405,5 @@ slideshow/clusterfuzz-testcase-minimized-POIXSLFFuzzer-6435650376957952.pptx,ext slideshow/clusterfuzz-testcase-minimized-POIFileHandlerFuzzer-6466833057382400.emf,"handle,extract",HEMF,,org.apache.poi.util.RecordFormatException,java.lang.IllegalStateException: Unexpected end-of-file, slideshow/clusterfuzz-testcase-minimized-POIHSLFFuzzer-4983252485210112.ppt,"handle,additional",HPSF,,java.lang.IndexOutOfBoundsException,Block 21 not found, slideshow/clusterfuzz-testcase-minimized-POIHSLFFuzzer-4983252485210112.ppt,handle,HSLF,,org.apache.poi.util.RecordFormatException,Tried to allocate an array, -slideshow/clusterfuzz-testcase-minimized-POIFileHandlerFuzzer-6060921738035200.wmf,handle,HWMF,,java.lang.IllegalStateException,invalid wmf file \ No newline at end of file +slideshow/clusterfuzz-testcase-minimized-POIFileHandlerFuzzer-6060921738035200.wmf,handle,HWMF,,java.lang.IllegalStateException,invalid wmf file +spreadsheet/LIBRE_OFFICE-128382-0.xlsx,handle,XSSF,,org.apache.poi.ss.formula.FormulaParseException,Illegal table name \ No newline at end of file diff --git a/test-data/spreadsheet/LIBRE_OFFICE-128382-0.xlsx b/test-data/spreadsheet/LIBRE_OFFICE-128382-0.xlsx new file mode 100755 index 0000000000..b476779931 Binary files /dev/null and b/test-data/spreadsheet/LIBRE_OFFICE-128382-0.xlsx differ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
