diff --git a/spec/node-spec.js b/spec/node-spec.js index edfc51ab1ede..e2d7d001eb49 100644 --- a/spec/node-spec.js +++ b/spec/node-spec.js @@ -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', () => { diff --git a/vendor/node b/vendor/node index 34b92f456a5a..45321d4843fd 160000 --- a/vendor/node +++ b/vendor/node @@ -1 +1 @@ -Subproject commit 34b92f456a5a17fb3b2e8c9cea9ae582d1eaa6de +Subproject commit 45321d4843fd33719fe7cda20cd19fb5a630b91d