pjfanning opened a new pull request, #1607:
URL: https://github.com/apache/poi/pull/1607

   Stacked on #1606: this branch is that PR's commit plus one more, so until 
#1606 is merged the diff here shows both. Only the last commit is new.
   
   These came out of a review of #1606. All of them were already in `Offset` 
before that PR.
   
   - **Negative height or width.** `OFFSET(A7,0,0,-4,1)` should be `A4:A7`, but 
the area was built from the range before it was normalised and came out as 
`A2:A7`, so `SUM` over it added two extra cells. The area is now built from the 
normalised ranges that are bounds-checked.
   - **Int overflow.** `OFFSET(A1,2147483647,0,2,1)` wrapped around in `offset 
+ length - 1`, passed the bounds check and returned an area instead of `#REF!`. 
`LinearOffsetRange` (package-private) now holds its values as longs.
   - **Too few arguments.** `Offset.evaluate` with one or two arguments threw 
an `ArrayIndexOutOfBoundsException`; it now returns `#VALUE!`. This is only 
reachable by calling `evaluate` directly, as the formula parser requires three 
arguments.
   - **Tests.** `TestOffset` in poi-ooxml asserted the out-of-bounds row and 
column in one formula, so the column check never ran. It now checks them 
separately, covers row 32768 and has its formatting tidied.
   
   Not changed: the bounds are still those of `SpreadsheetVersion.EXCEL2007` 
for every workbook (as since bug 66614), so in an `.xls` workbook an offset 
past row 65,536 or column 256 gives an empty area rather than `#REF!`. `Offset` 
is a `Function` and has no access to the workbook's version, so that needs a 
separate change.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to