Merge pull request #11527 from electron/fix-buffer-crash-master
master: Fix crash when using crypto module
This commit is contained in:
commit
a161f6e368
2 changed files with 15 additions and 1 deletions
|
@ -313,6 +313,20 @@ describe('node feature', () => {
|
|||
buffer = Buffer.from(new Array(4097).join(' '))
|
||||
assert.equal(buffer.length, 4096)
|
||||
})
|
||||
|
||||
it('does not crash for crypto operations', () => {
|
||||
const crypto = require('crypto')
|
||||
const data = 'lG9E+/g4JmRmedDAnihtBD4Dfaha/GFOjd+xUOQI05UtfVX3DjUXvrS98p7kZQwY3LNhdiFo7MY5rGft8yBuDhKuNNag9vRx/44IuClDhdQ='
|
||||
const key = 'q90K9yBqhWZnAMCMTOJfPQ=='
|
||||
const cipherText = '{"error_code":114,"error_message":"Tham số không hợp lệ","data":null}'
|
||||
for (let i = 0; i < 10000; ++i) {
|
||||
let iv = Buffer.from('0'.repeat(32), 'hex')
|
||||
let input = Buffer.from(data, 'base64')
|
||||
let decipher = crypto.createDecipheriv('aes-128-cbc', Buffer.from(key, 'base64'), iv)
|
||||
let result = Buffer.concat([decipher.update(input), decipher.final()])
|
||||
assert.equal(cipherText, result)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('process.stdout', () => {
|
||||
|
|
2
vendor/node
vendored
2
vendor/node
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 34b92f456a5a17fb3b2e8c9cea9ae582d1eaa6de
|
||||
Subproject commit 45321d4843fd33719fe7cda20cd19fb5a630b91d
|
Loading…
Reference in a new issue