electron: Crash while doing setPrivateKey on ECDH
- Output of
node_modules/.bin/electron --version
: v4.0.1 - Operating System (Platform and Version): Windows 10 1809 (64 bit)
- Output of
node_modules/.bin/electron --version
on last known working Electron version (if applicable): v3.1.1
Expected Behavior Shouldn’t crash 😃
Actual behavior Electron crashes (half of it, I mean the process is still going on at almost 100% CPU, in background)
To Reproduce
const dh = crypto.createECDH('prime256v1');
console.log("step1");
dh.setPrivateKey(privateKey, 'base64');
console.log("step2");
Additional Information It works with electron 3.1.1, but not 4.0.1 Maybe an update of Node could fix the issue
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (6 by maintainers)
@chevonc should go out in the next releases of 4.x and 5.x-beta.
Thank you so much @nornagon 😃 I wish I’d knew how to fix it myself, I learnt a little bit about electron uses patches. Thanks!
I did a little more digging and it looks like the culprit is actually this in node_crypto.cc:
The BoringSSL implementation of that function expects the key to be non-null.
Sadly this workaround doesn’t seem to work for me @v5.0.0-beta.3… Crashes with an malloc error. Any other ideas? This bug is currently keeping me back quite a bit @chevonc @codebytere.
The last working release I could find on npm was v4.0.0-nightly.20180821