A region blocked by a formula and an array reading its anchor, the formula moved away, was sent again without its table changing, so the array kept spilling where opening the file found the cycle (fuzz input a704f635622be956).
- commit
- fddc65e77d6cd4e9c1928f37e5d1a7859e9411e5
- parent
- 8c1518833dbbad93d2b62d22c4e4d521c099dccb
- author
- Dami <dami.etoile@gmail.com>
- kind
- fix risk score 1.3 of 3, Jev's estimate
| M | internal/ | 14 | ++++++++++++++ |
| M | internal/ | 4 | +++- |
| A | internal/ | 2 | ++ |
@@ -131,3 +131,17 @@ func TestArrayOverRegionItReadsTheCellsOf(t *testing.T) {
131131 wantShown(t, opened, want)132132 }133133 }134+135+// A region blocked by a formula and an array reading its cells, the formula136+// cleared, is blocked by the array alone, which then finds the cycle.137+func TestRegionFreedButForAnArrayReadingIt(t *testing.T) {138+ op := LiveOp{Region: "a", Reset: true, Header: liveRow("x", "y", "z"), Rows: []LiveRow{liveRow("1", "2", "3")}}139+ s := New()140+ sent(t, s, "a", "F10")141+ s.Set(at("F11"), "=SEQUENCE(1)")142+ s.Set(at("H9"), "=SORT(F6:F10)")143+ apply(t, s, op)144+ s.Set(at("F11"), "")145+ feedStale(s.Book(), map[string]LiveOp{"a": op})146+ wantShown(t, s, map[string]string{"H9": "#REF!", "F10": "x", "H11": "3"})147+}@@ -167,7 +167,9 @@ func (s *Sheet) writeTable(r Region, me *regionMeta, header LiveRow, rows []Live
167167 for _, c := range changed {168168 s.freedFor(c.a)169169 }170- if after, _ := me.table(); !had || after != before {170+ // Blocked, what's in its way may have gone but for arrays, which then171+ // find it (heldByArrays).172+ if after, _ := me.table(); !had || after != before || me.why != "" {171173 changed = append(changed, s.regionMoved(before, after, had)...)172174 }173175 if !had || was != me.written || shape != [2]int{me.rows, me.cols} { // moved, or its table changed shape