poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 61059] New: [PATCH] Fix incorrect use of short when unsigned short was required in NamePtg
Date Mon, 01 May 2017 20:06:39 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=61059

            Bug ID: 61059
           Summary: [PATCH] Fix incorrect use of short when unsigned short
                    was required in NamePtg
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: SS Common
          Assignee: dev@poi.apache.org
          Reporter: admin.apache@moparisthebest.com
  Target Milestone: ---

Created attachment 34967
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34967&action=edit
0001-Fix-incorrect-use-of-short-when-unsigned-short-was-r.patch

A large spreadsheet (my guess is > 32k rows) crashes in the
FormulaEvaluator.evaluate(Cell) function with this error:


java.lang.ArrayIndexOutOfBoundsException: -32760
        at java.util.ArrayList.elementData(ArrayList.java:418) ~[na:1.8.0_121]
        at java.util.ArrayList.get(ArrayList.java:431) ~[na:1.8.0_121]
        at
org.apache.poi.hssf.model.LinkTable.getNameRecord(LinkTable.java:321)
~[poi-3.16.jar:3.16]
        at
org.apache.poi.hssf.model.InternalWorkbook.getNameRecord(InternalWorkbook.java:1660)
~[poi-3.16.jar:3.16]
        at
org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook.getName(HSSFEvaluationWorkbook.java:220)
~[poi-3.16.jar:3.16]
        at
org.apache.poi.ss.formula.WorkbookEvaluator.getEvalForPtg(WorkbookEvaluator.java:616)
~[poi-3.16.jar:3.16]
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:525)
~[poi-3.16.jar:3.16]
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:290)
~[poi-3.16.jar:3.16]
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:232)
~[poi-3.16.jar:3.16]
        at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCellValue(HSSFFormulaEvaluator.java:200)
~[poi-3.16.jar:3.16]
        at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluate(BaseFormulaEvaluator.java:101)
~[poi-3.16.jar:3.16]

I tracked down the bug in org.apache.poi.ss.formula.ptg.NamePtg line 47:

field_1_label_index = in.readShort();

Changing that to

field_1_label_index = in.readUShort();

Fixes the problem.  I *think* that is the *right* fix, but you guys might know
better.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message