Gridjs-spreadsheet can lock up/crash browser when first column is hidden

The spreadsheet in the following file causes gridjs-spreadsheet to enter an infinite loop trying to calculate the width of all the columns:

long-cell.xlsx.zip (7.2 KB)

The minimal repro is:

  • Hide column A (so that its width is set to 0)
  • Insert text in cell B1 such that it overflows past column C
  • Insert some short text in cell C2

The problem is with the following check in loadData:

if (s.cols.maxwidth) {
    var S = s.cols.sumWidth(0, s.cols.len);
    s.cols.maxwidth > S && (s.cols.len += (s.cols.maxwidth - S) / s.cols.getWidth(0) + 1);
}

s.cols.getWidth(0) returns 0, because the first column is hidden, so the division results in Infinity. s.cols.len then gets set to Infinity, so when totalWidth is called (eg: when setting the active sheet), sumWidth is invoked with Infinity as the second arg, resulting in an infinite loop.

@jrf.att
Thanks a lot.
We can reproduce this issue.We will fix it soon.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSGRIDJS-889

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as CELLSGRIDJS-889) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

@jrf.att
please try the latest v23.8.0 GridJs dll and the client side js ,the issue shall be fixed.