You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2014/03/28 17:28:27 UTC

[Bug 56328] New: FormulaParser is hard-coded to assume a maximum of 65536 rows

https://issues.apache.org/bugzilla/show_bug.cgi?id=56328

            Bug ID: 56328
           Summary: FormulaParser is hard-coded to assume a maximum of
                    65536 rows
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: dtn-asfbugs@corefiling.co.uk

Summary: FormulaParser is hard-coded to assume a maximum of 65536 rows

Unfortunately, this means that formulae attempting to reference rows at larger
numbers (possible in Excel 2007 and greater) will not parse, failing with 

org.apache.poi.ss.formula.FormulaParseException: Cell reference expected after
sheet name at index ...

The fix is to change the constant on line 722, which currently looks like:

if (i<1 || i>65536) {

A review for other hard-coding of 65536 might be an idea at this point too. I
can see it in several other parts of the codebase including AreaRange.

-- 
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


[Bug 56328] FormulaParser is hard-coded to assume a maximum of 65536 rows

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56328

--- Comment #2 from David North <dt...@corefiling.co.uk> ---
Created attachment 31456
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31456&action=edit
Patch to fix FormulaParser using SpreadsheetVersion

Problematic references:

./org/apache/poi/ss/formula/FormulaParser.java:            if (i<1 || i>65536)
{

./org/apache/poi/ss/util/AreaReference.java:            // Represented
internally as x$1 to x$65536
./org/apache/poi/ss/util/AreaReference.java:        return new
AreaReference(start + "$1:" + end + "$65536");

The attached patch fixes FormulaParser, which turned out to be trivial as
there's already a SpreadsheetVersion in scope.

Fixing AreaReference is a little more involved as the information needs passing
through to the right point. So I think I'll save that treat for next week -
happy weekend.

-- 
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


[Bug 56328] FormulaParser is hard-coded to assume a maximum of 65536 rows

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56328

--- Comment #4 from Yaniv Kunda <ya...@kundas.net> ---
This can be a good reference for writing a complete unit test:
http://superuser.com/questions/366468/what-is-the-maximum-allowed-rows-in-a-microsoft-excel-xls-or-xlsx

-- 
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


[Bug 56328] FormulaParser is hard-coded to assume a maximum of 65536 rows

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56328

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
Any chance you could both:
 * Grep to find some more places with that in? (Check org.apache.poi.ss and
.xssf, it's fine to have it in .hssf classes)
 * See if you can work up a patch which checks the kind of workbook it is, and
does the range check based on that? (We've got the constants in
SpreadsheetVersion)

Bonus marks if you can get it done before the CoreFiling Friday pub trip time
;-)

-- 
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


[Bug 56328] FormulaParser is hard-coded to assume a maximum of 65536 rows

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56328

--- Comment #3 from Nick Burch <ap...@gagravarr.org> ---
Thanks for that David, applied in r1582892.

If you could do a patch for AreaRange, that'd be great. Also, if you could
knock up a quick junit test case which tries to parse a formula with a row
>65536, and tries it with HSSF + XSSF, to check it's invalid for HSSF but valid
for XSSF, that'd be great!

-- 
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