bug fix: when the arrayBuffer is to large, __toBuffer will cause error #937
No reviewers
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#937
Loading…
Reference in New Issue
No description provided.
Delete Branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The __toBuufer function use "x.push.apply",but the argument has limits. when the length of array is larger than 65536, it will cause an error: Maximum call stack size exceeded.(refer to: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply)
so i apply chunks of the array at a time.
On the read side, before adding the array input type, a helper function used to chunk in 10KB units to circumvent the same problem. Not sure why a similar change wasn't also applied here.
a8736580a5/index.html (L91-L96)
Here's a test fiddle that fails in the current version https://jsfiddle.net/pg6oghLu/ and passes with the proposed changes https://jsfiddle.net/pg6oghLu/1/ :
@SheetJSDev So should I apply this change to the fixdata() function? but i can't find this function in 'index.html'.:(
@hacker1117 sorry I wasn't clear. For the same reason that you encountered, there used to be a chunking algorithm in processing ArrayBuffers that used
QUANTUM=10240
instead of the original 32768, assumably because of browser compatibility. We'll rework the commit and add a test :)@hacker1117 The 10240 threshold works in IE8+ as evidenced in the browser test https://saucelabs.com/beta/builds/3de647aa4e09454fa30894170668a8d4 . For whatever reason, IE8 was failing on 32768, which is probably why we used the lower number in the first place.
Pull request closed