pjfanning opened a new pull request, #1293:
URL: https://github.com/apache/poi/pull/1293
Found by fuzzing every registered function with scalar, area and array
arguments. Each of these escaped the evaluator as a `ClassCastException`,
`IllegalArgumentException` or `IllegalStateException`; Excel either accepts the
value or reports `#VALUE!`.
| Formula | Before | After (Excel) |
|---|---|---|
| `=COUNTIF(5,5)`, `=COUNTBLANK(5)` | `IllegalArgumentException: Bad range
arg type` | `#VALUE!` |
| `=INDEX(5,1)`, `=INDEX("abc",1)` | `IllegalStateException: Incomplete
code` | `5`, `abc` (a single value is a 1×1 array); `INDEX(5,2)` is `#REF!`,
`INDEX(NA(),1)` is `#N/A` |
| `=IFS(1,"a")`, `=IFS(B1=5,"a")` when B1 is 5 | `ClassCastException` | `a`
— the logical test is coerced like `IF`'s |
| `=IFS("abc","a")` | `ClassCastException` | `#VALUE!` |
| `=POISSON(2,3,1)`, `=POISSON.DIST(2,3,0)` | `ClassCastException` |
cumulative / non-cumulative; `"abc"` is `#VALUE!` |
| `=MMULT(2,{1,2,3})` | `ClassCastException` (scalar first argument,
multi-element result) | the 1×3 result, anchored on the area argument |
| `=BIN2DEC({101})`, `=HEX2DEC({"FF"})`, `=OCT2DEC({"17"})`,
`=FACTDOUBLE({5})`, `=COMPLEX(1,1,{"j"})`, `=WORKDAY(1,{5})` |
`IllegalArgumentException`/`IllegalStateException` from the coercion | the
value (`5`, `255`, `15`, `15`, `1+j`, `8`) |
| the same with a multi-cell area that does not intersect the formula row |
same exceptions | `#VALUE!` |
`FACTDOUBLE(NA())` and `BIN2DEC(NA())` now also pass the error through
instead of `#VALUE!`/`#NUM!`.
Tests: new `TestArgumentTypes`; `org.apache.poi.ss.formula.*` passes.
🤖 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]