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 2022/03/07 11:29:54 UTC

[Bug 65939] New: StackOverflow on notifyUpdateCell

https://bz.apache.org/bugzilla/show_bug.cgi?id=65939

            Bug ID: 65939
           Summary: StackOverflow on notifyUpdateCell
           Product: POI
           Version: 5.2.0-FINAL
          Hardware: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: freeman656@gmail.com
  Target Milestone: ---

A java.lang.StackOverflowError occurs on the method
org.apache.poi.ss.formula.CellCacheEntry.recurseClearCachedFormulaResults in
the following condition :
- Create a circular reference on the cell itself (e.g. A1 on cell A1).
- Remove the formula
- Call the notifyUpdateCell method.

Below, a sample code, tested on version 5.2.1, Java 17. :

public static void main(String[] args) {
        try (var workbook = new XSSFWorkbook()) {
                var sheet = workbook.createSheet();
                var row = sheet.createRow(0);
                var cell = row.createCell(0);
                cell.setCellFormula("A1");
                var formulaEvaluator =
workbook.getCreationHelper().createFormulaEvaluator();
                formulaEvaluator.notifyUpdateCell(cell);
                formulaEvaluator.evaluateAll();

               
System.out.println(FormulaError.forInt(cell.getErrorCellValue()));

                cell.setCellFormula(null);
                formulaEvaluator.notifyUpdateCell(cell);

        } catch (IOException e) {
                e.printStackTrace();
        }
}

-- 
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 65939] StackOverflow on notifyUpdateCell

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

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |major

-- 
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 65939] StackOverflow on notifyUpdateCell

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

--- Comment #2 from PJ Fanning <fa...@yahoo.com> ---
I added r1898677 but I think there is a fair amount more work to be done.

-- 
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 65939] StackOverflow on notifyUpdateCell

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

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

-- 
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 65939] StackOverflow on notifyUpdateCell

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

--- Comment #4 from Cédric O <fr...@gmail.com> ---
(In reply to PJ Fanning from comment #2)
> I added r1898677 but I think there is a fair amount more work to be done.

Ok nice, what kind of work needs to be done in your opinion regarding this
issue ?

-- 
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 65939] StackOverflow on notifyUpdateCell

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

--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
* there are misbehaviours commented out or disabled in the new tests I added
* there are other scenarios to test - like A1 set to `=A2` and A2 set to = `A1`

-- 
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 65939] StackOverflow on notifyUpdateCell

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

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
In my online copy of Excel, I set the value of cell A1 to `=A1` and was
surprised to find it evaluate to `0` as opposed to a #REF error.

Would you like to try to submit your own patch?

-- 
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 65939] StackOverflow on notifyUpdateCell

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

--- Comment #3 from Cédric O <fr...@gmail.com> ---
(In reply to PJ Fanning from comment #1)
> In my online copy of Excel, I set the value of cell A1 to `=A1` and was
> surprised to find it evaluate to `0` as opposed to a #REF error.
> 
> Would you like to try to submit your own patch?

I also get 0 in the MS Excel cell, but in the bottom left of the app, it still
shows a circular reference error on cell A1.

-- 
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 65939] StackOverflow on notifyUpdateCell

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

--- Comment #6 from PJ Fanning <fa...@yahoo.com> ---
I added some extra test coverage and things seem ok - could certainly do with
more testing but the initial test scenario seems to be fixed

-- 
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 65939] StackOverflow on notifyUpdateCell

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

Cédric O <fr...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

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