-
Bug
-
Resolution: Fixed
-
Normal
-
5.6.0
-
None
-
Security Level: Jimmy
-
None
-
None
Steps to Reproduce
1. run the test case keikai.test/io.keikai.model.ImporterTest.nameIndexOverflow()
check branch https://github.com/zkoss/keikaicml/tree/KEIKAI-432
Current Result
java.lang.IndexOutOfBoundsException: Index -30353 out of bounds for length 35184
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at io.keikai.model.impl.sys.formula.ParsingBook.getNameInfo(ParsingBook.java:241)
at io.keikai.model.impl.sys.formula.ParsingBook.getNameText(ParsingBook.java:227)
at io.keikai.model.impl.sys.formula.FormulaEngineImpl.toDependRef(FormulaEngineImpl.java:354)
at io.keikai.model.impl.sys.formula.FormulaEngineImpl.updateDependencyTable(FormulaEngineImpl.java:1492)
at io.keikai.model.impl.CellImpl.setValue(CellImpl.java:472)
at io.keikai.model.impl.CellImpl.setValue(CellImpl.java:418)
at io.keikai.model.impl.CellImpl.setFormulaValue(CellImpl.java:277)
at io.keikai.model.impl.CellImpl.setFormulaValue(CellImpl.java:251)
at io.keikai.model.impl.CellProxy.setFormulaValue(CellProxy.java:113)
at io.keikai.importer.XlsxImporter.importCell(XlsxImporter.java:1754)
at io.keikai.importer.XlsxImporter.importRow(XlsxImporter.java:1702)
at io.keikai.importer.XlsxImporter.imports(XlsxImporter.java:287)
at io.keikai.range.impl.imexp.ExcelImportAdapter.imports(ExcelImportAdapter.java:48)
at io.keikai.range.impl.imexp.AbstractImporter.imports(AbstractImporter.java:57)
at io.keikai.ui.Spreadsheet.getSBook(Spreadsheet.java:675)
at io.keikai.ui.Spreadsheet.getSelectedSSheet(Spreadsheet.java:854)
at io.keikai.ui.Spreadsheet.doInvalidate(Spreadsheet.java:2587)
at io.keikai.ui.Spreadsheet.invalidate(Spreadsheet.java:2444)
at io.keikai.ui.Spreadsheet.setSrc(Spreadsheet.java:903)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.zkoss.zk.ui.metainfo.Property.assign0(Property.java:332)
at org.zkoss.zk.ui.metainfo.Property.assign(Property.java:174)
at org.zkoss.zk.ui.metainfo.ComponentInfo.applyProperties(ComponentInfo.java:742)
at org.zkoss.zk.ui.impl.AbstractUiFactory.newComponent(AbstractUiFactory.java:146)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:927)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:897)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:784)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:844)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:802)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:748)
at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:469)
at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:377)
at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215)
at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:140)
Expected Result
no error
Debug Information
1. it only prints the exception if you configure the logger correctly.
2. root cause
public class NamePtg extends OperandPtg implements WorkbookDependentFormula { ... private int field_1_label_index; ... public void write(LittleEndianOutput out) { ... out.writeShort(field_1_label_index); }
When serializing a NamePtg, it writes an integer into a short and causes the overflow.