cannot import big files, String.fromCharCode(...(await IOUtils.read(file.path)) fails
Categories
(MailNews Core :: Security: OpenPGP, defect)
Tracking
(thunderbird_esr91 unaffected, thunderbird100+ fixed)
Tracking | Status | |
---|---|---|
thunderbird_esr91 | --- | unaffected |
thunderbird100 | + | fixed |
People
(Reporter: KaiE, Assigned: mkmelin)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
rjl
:
approval-comm-beta+
|
Details |
Bug 1677088 replaced file reading code, and changed it to this syntax in several places:
String.fromCharCode(...(await IOUtils.read(file.path))
When attempting to import a 2 MB file, the code fails:
RangeError: too many function arguments
EnigmailCommon_importObjectFromFile chrome://openpgp/content/ui/commonWorkflows.js:144
Can you please change all places with this approach to use code that supports bigger files?
Reporter | ||
Comment 1•3 years ago
|
||
This seems to work:
- keyBlock = String.fromCharCode(...(await IOUtils.read(file.path)));
+
+ let data = await IOUtils.read(file.path);
+
+ keyBlock = "";
+ for (let i = 0; i < data.length; i++) {
+ keyBlock += String.fromCharCode(data[i]);
+ }
Reporter | ||
Updated•3 years ago
|
Comment 2•3 years ago
|
||
I introduced a uint8ArrayToByteString util a few days ago, https://searchfox.org/comm-central/rev/a0e7f418beb151ae9c0d6f24f88d2aa61ffdf0cd/mailnews/base/src/MailStringUtils.jsm#26
Assignee | ||
Comment 3•3 years ago
|
||
I'll take care of it. What an annoying trap!
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 4•3 years ago
|
||
String.fromCharCode doesn't like getting passed too many arguments, like one gets for megabytes of data.
Reporter | ||
Comment 5•3 years ago
|
||
please uplift to beta
Assignee | ||
Updated•3 years ago
|
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/3116051508f0
fix importing of large openpgp key files. r=kaie
Comment 7•3 years ago
|
||
Comment on attachment 9271233 [details]
Bug 1763258 - fix importing of large openpgp key files. r=kaie
[Triage Comment]
Approved for beta per Kai's request in comment 5.
Comment 8•3 years ago
|
||
bugherder uplift |
Thunderbird 100.0b2:
https://hg.mozilla.org/releases/comm-beta/rev/a6ccaf95df90
Description
•