Issue 1:
I have read the Contributing Guidelines for this project.

I agree to follow the Code of Conduct that this project adheres to.

I have searched the issue tracker for an issue that matches the one I want to file, without success.

Back in Electron 5 I reported issue #18733. It was automatically closed lately, however it still affects Electron versions up to 11 (but not, as far as I can tell, version 12). Anyway the instructions said I should reopen it if it still affects a supported version, so here it is.

Much discussion is on that thread. @dsanders11 diagnosed the problem there.

Issue Details

Electron Version:

5 through 11 (not 12)

Operating System:

Windows 10

Last known Working Electron versions:

5.0.0.beta8 is OK, 5.0.0.beta9 crashes.

Expected Behavior

The following code, when run in a renderer process, should not crash.

let decoder = new TextDecoder("utf8");
let msg = "a".repeat(4096);	// Exact minimum size that crashes for me, i.e. 4095 does not.
let buf = Buffer.from(msg);
decoder.decode(buf);

Actual Behavior

It does crash in Electron 11, but not Electron 12.

To Reproduce

https://github.com/fohristiwhirl/electron_crash_test

git clone https://github.com/fohristiwhirl/electron_crash_test -b master
cd electron_crash_test
electron .

Issue 2:
Preflight Checklist

I have read the Contributing Guidelines for this project.

I agree to follow the Code of Conduct that this project adheres to.

I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

Electron Version:

7.0.0

Operating System:

Windows 8.1

Last Known Working Electron version:

3.0.3 (we're in process of upgrading from this version to the latest, so it is unclear as to when exactly the undesired behavior was introduced)

Expected Behavior

Expecting no crash when the following code is executed:

const makeArray = (n, min = 1, max = Number.MAX_SAFE_INTEGER) => [...Array(n).keys()].map(i => (i + min) % max);
const encodeBase64 = (array) => btoa(String.fromCharCode(...array));

let buffer = Buffer.from(encodeBase64(makeArray(1024 * 4, 0, 256)), 'base64');
let blob = new Blob([buffer], { type: 'image/png' });

Actual Behavior

The renderer process crashes while executing new Blob([buffer], { type: 'image/png' }) statement. The Electron app window is blanked out, and if the Developer Tools is open, the following pop-up message is displayed: "DevTools was disconnected from the page". No Developer Tools Console messages. No messages in the OS console, either.

To Reproduce

Clone the electron-quick-start repository, and insert the JavaScript code above into renderer.js file. Don't forget to set nodeIntegration = true for the main window, otherwise Buffer won't be found.

Electron Fiddle gist of the same: https://gist.github.com/70e141736d51fb0a6936c110b6f7c9f5

Additional Information

This behavior is related to Buffer.from('...', 'base64') - that is, Base64 decoding - because providing the Blob constructor a buffer created by other means seems to work fine.

Also, the Base64-encoded string in the code above is just a simple way to reproduce the problem. The crash occurs when legitimate Base64-encoded images are processed as well.