From 199fa9f8ddcb8be78673a93db8719819ab3a7deb Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 17 May 2013 13:55:29 -0700 Subject: [PATCH 1/8] crypto: Don't ignore verify encoding argument --- src/node_crypto.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 774550c995..d591510163 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3309,7 +3309,7 @@ class Verify : public ObjectWrap { unsigned char* hbuf = new unsigned char[hlen]; ssize_t hwritten = StringBytes::Write( - reinterpret_cast(hbuf), hlen, args[1], BINARY); + reinterpret_cast(hbuf), hlen, args[1], encoding); assert(hwritten == hlen); int r; From 49300a4fa655f9d1150aba7dff08fec432e94a62 Mon Sep 17 00:00:00 2001 From: Brandon Frohs Date: Thu, 16 May 2013 11:03:25 -0300 Subject: [PATCH 2/8] doc: Fix link to open issues on GitHub. --- doc/api/vm.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/vm.markdown b/doc/api/vm.markdown index 49df036f2f..b454c7308c 100644 --- a/doc/api/vm.markdown +++ b/doc/api/vm.markdown @@ -13,8 +13,8 @@ JavaScript code can be compiled and run immediately or compiled, saved, and run ## Caveats The `vm` module has many known issues and edge cases. If you run into -issues or unexpected behavior, please consult -[the open issues on GitHub](https://github.com/joyent/node/issues/search?q=vm). +issues or unexpected behavior, please consult [the open issues on +GitHub](https://github.com/joyent/node/search?q=vm+state%3Aopen&type=Issues). Some of the biggest problems are described below. ### Sandboxes From d2fdae197ac542f686ee06835d1153dd43b862e5 Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 17 May 2013 13:59:10 -0700 Subject: [PATCH 3/8] 2013.05.17, Version 0.10.7 (Stable) * uv: upgrade to v0.10.7 * npm: Upgrade to 1.2.21 * crypto: Don't ignore verify encoding argument (isaacs) * buffer, crypto: fix default encoding regression (Ben Noordhuis) * timers: fix setInterval() assert (Ben Noordhuis) --- AUTHORS | 2 ++ ChangeLog | 15 ++++++++++++++- src/node_version.h | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 63f04692dd..c30cf8bc65 100644 --- a/AUTHORS +++ b/AUTHORS @@ -447,3 +447,5 @@ Kevin Locke Daniel Moore Robert Kowalski Benoit Vallée +Ryuichi Okumura +Brandon Frohs diff --git a/ChangeLog b/ChangeLog index cd00e9b5dc..fdc7cb1f1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,17 @@ -2013.05.14, Version 0.10.6 (Stable) +2013.05.17, Version 0.10.7 (Stable) + +* uv: upgrade to v0.10.7 + +* npm: Upgrade to 1.2.21 + +* crypto: Don't ignore verify encoding argument (isaacs) + +* buffer, crypto: fix default encoding regression (Ben Noordhuis) + +* timers: fix setInterval() assert (Ben Noordhuis) + + +2013.05.14, Version 0.10.6 (Stable), 5deb1672f2b5794f8be19498a425ea4dc0b0711f * module: Deprecate require.extensions (isaacs) diff --git a/src/node_version.h b/src/node_version.h index 04d7341ee0..ec46b53170 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -26,7 +26,7 @@ #define NODE_MINOR_VERSION 10 #define NODE_PATCH_VERSION 7 -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_TAG # define NODE_TAG "" From bae6d089a4d094434c7f5c9549a51aa70076eb15 Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 17 May 2013 14:37:44 -0700 Subject: [PATCH 4/8] Now working on 0.10.8 --- src/node_version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_version.h b/src/node_version.h index ec46b53170..4b804bd76c 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -24,9 +24,9 @@ #define NODE_MAJOR_VERSION 0 #define NODE_MINOR_VERSION 10 -#define NODE_PATCH_VERSION 7 +#define NODE_PATCH_VERSION 8 -#define NODE_VERSION_IS_RELEASE 1 +#define NODE_VERSION_IS_RELEASE 0 #ifndef NODE_TAG # define NODE_TAG "" From 77de20708935d33123ac97f135d90197db8e800c Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 17 May 2013 14:38:02 -0700 Subject: [PATCH 5/8] blog: Release 0.10.7 --- doc/blog/release/v0.10.7.md | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 doc/blog/release/v0.10.7.md diff --git a/doc/blog/release/v0.10.7.md b/doc/blog/release/v0.10.7.md new file mode 100644 index 0000000000..e31bf9c4e6 --- /dev/null +++ b/doc/blog/release/v0.10.7.md @@ -0,0 +1,65 @@ +date: Fri May 17 14:36:03 PDT 2013 +version: 0.10.7 +category: release +title: Node v0.10.7 (Stable) +slug: node-v0-10-7-stable + +2013.05.17, Version 0.10.7 (Stable) + +* uv: upgrade to v0.10.7 + +* npm: Upgrade to 1.2.21 + +* crypto: Don't ignore verify encoding argument (isaacs) + +* buffer, crypto: fix default encoding regression (Ben Noordhuis) + +* timers: fix setInterval() assert (Ben Noordhuis) + + +Source Code: http://nodejs.org/dist/v0.10.7/node-v0.10.7.tar.gz + +Macintosh Installer (Universal): http://nodejs.org/dist/v0.10.7/node-v0.10.7.pkg + +Windows Installer: http://nodejs.org/dist/v0.10.7/node-v0.10.7-x86.msi + +Windows x64 Installer: http://nodejs.org/dist/v0.10.7/x64/node-v0.10.7-x64.msi + +Windows x64 Files: http://nodejs.org/dist/v0.10.7/x64/ + +Linux 32-bit Binary: http://nodejs.org/dist/v0.10.7/node-v0.10.7-linux-x86.tar.gz + +Linux 64-bit Binary: http://nodejs.org/dist/v0.10.7/node-v0.10.7-linux-x64.tar.gz + +Solaris 32-bit Binary: http://nodejs.org/dist/v0.10.7/node-v0.10.7-sunos-x86.tar.gz + +Solaris 64-bit Binary: http://nodejs.org/dist/v0.10.7/node-v0.10.7-sunos-x64.tar.gz + +Other release files: http://nodejs.org/dist/v0.10.7/ + +Website: http://nodejs.org/docs/v0.10.7/ + +Documentation: http://nodejs.org/docs/v0.10.7/api/ + +Shasums: + +``` +95d64001ccd5a17c2c25f1ae4b0358b6131e7cb8 node-v0.10.7-darwin-x64.tar.gz +c34f991cc0752679002f763b2b3c8927babb08d8 node-v0.10.7-darwin-x86.tar.gz +673c287bcf671eced6aa94637b7c91e5149f4c56 node-v0.10.7-linux-x64.tar.gz +9f14d4f9add721148f0c15f093d3e6b1fa3820c9 node-v0.10.7-linux-x86.tar.gz +1fb7dc4195a9dd228039f5f7ca2cb9f7c35b105a node-v0.10.7-sunos-x64.tar.gz +d84cd8afb50df44483b9dab0c65d5c81f07ac4a2 node-v0.10.7-sunos-x86.tar.gz +d7794a7da103d639fdec4b9e7236a5a0a4330297 node-v0.10.7-x86.msi +0524ad9268095c9ed435708268e6aad7968309f7 node-v0.10.7.pkg +f2bde505faf6ffed3084c8e550a9e6d4311f13d5 node-v0.10.7.tar.gz +5f50384766dd5435dba4989d95032452754150bf node.exe +809f12f84c8495d101ce6ae443890e8533695ab0 node.exp +5a7355e2f75ae3f72deab75f4c9f93e4e5325584 node.lib +6e45953bd7488a4236c43fea93b05da0854158a7 node.pdb +fc5e3b2b1c74e53f1d214a9e2d5af30fe5247381 x64/node-v0.10.7-x64.msi +aa67bbd421f26b37fa09ce30d5e626106677853e x64/node.exe +b289989a156d4d7055554962e6f00ba3e380aeea x64/node.exp +0dbecc5007c9e28ad488d2058157f8360eaed958 x64/node.lib +e4b63472787a3db6a3d85237e8c7fb4d973f797b x64/node.pdb +``` From f57ff787aafc0ac20b489acd1ec4dc9d09193000 Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 17 May 2013 16:58:05 -0700 Subject: [PATCH 6/8] src: Remove superfluous static_cast --- src/string_bytes.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/string_bytes.cc b/src/string_bytes.cc index 90050dfcb5..5bf0a30e27 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -556,8 +556,7 @@ Local StringBytes::Encode(const char* buf, Local val; switch (encoding) { case BUFFER: - return scope.Close( - Buffer::New(static_cast(buf), buflen)->handle_); + return scope.Close(Buffer::New(buf, buflen)->handle_); case ASCII: if (contains_non_ascii(buf, buflen)) { From d5d5170c359fc96f36650cdd9b84cbb013c33735 Mon Sep 17 00:00:00 2001 From: Trevor Norris Date: Mon, 20 May 2013 12:35:31 -0700 Subject: [PATCH 7/8] string_bytes: strip padding from base64 strings Because of variations in different base64 implementation, it's been decided to strip all padding from the end of a base64 string and calculate its size from that. --- src/string_bytes.cc | 15 +++++++-------- test/simple/test-buffer.js | 4 ++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/string_bytes.cc b/src/string_bytes.cc index 5bf0a30e27..7ba2caf93d 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -63,16 +63,15 @@ static inline size_t base64_decoded_size_fast(size_t size) { } static inline size_t base64_decoded_size(const char* src, size_t size) { - size = base64_decoded_size_fast(size); + if (size == 0) + return 0; - const char* end = src + size; - // check for trailing padding (1 or 2 bytes) - if (size > 0) { - if (end[-1] == '=') size--; - if (size > 0 && end[-2] == '=') size--; - } + if (src[size - 1] == '=') + size--; + if (size > 0 && src[size - 1] == '=') + size--; - return size; + return base64_decoded_size_fast(size); } diff --git a/test/simple/test-buffer.js b/test/simple/test-buffer.js index 20a6bdba96..3808442ad1 100644 --- a/test/simple/test-buffer.js +++ b/test/simple/test-buffer.js @@ -980,6 +980,10 @@ assert.throws(function() { } })(); +// Make sure byteLength properly checks for base64 padding +assert.equal(Buffer.byteLength('aaa=', 'base64'), 2); +assert.equal(Buffer.byteLength('aaaa==', 'base64'), 3); + // Regression test for #5482: should throw but not assert in C++ land. assert.throws(function() { Buffer('', 'buffer'); From 3a2b5030ae1cd200e92eaf3928bd20a8deda50c6 Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 17 May 2013 17:19:12 -0700 Subject: [PATCH 8/8] crypto: Clear error after DiffieHellman key errors Fixes #5499 --- src/node_crypto.cc | 17 ++++++++++------- test/simple/test-crypto.js | 16 +++++++++++----- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index d591510163..93f88202f7 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -67,6 +67,14 @@ namespace crypto { using namespace v8; +// Forcibly clear OpenSSL's error stack on return. This stops stale errors +// from popping up later in the lifecycle of crypto operations where they +// would cause spurious failures. It's a rather blunt method, though. +// ERR_clear_error() isn't necessarily cheap either. +struct ClearErrorOnReturn { + ~ClearErrorOnReturn() { ERR_clear_error(); } +}; + static Persistent errno_symbol; static Persistent syscall_symbol; static Persistent subject_symbol; @@ -908,13 +916,6 @@ int Connection::HandleBIOError(BIO *bio, const char* func, int rv) { int Connection::HandleSSLError(const char* func, int rv, ZeroStatus zs) { - // Forcibly clear OpenSSL's error stack on return. This stops stale errors - // from popping up later in the lifecycle of the SSL connection where they - // would cause spurious failures. It's a rather blunt method, though. - // ERR_clear_error() isn't necessarily cheap either. - struct ClearErrorOnReturn { - ~ClearErrorOnReturn() { ERR_clear_error(); } - }; ClearErrorOnReturn clear_error_on_return; (void) &clear_error_on_return; // Silence unused variable warning. @@ -3603,6 +3604,8 @@ class DiffieHellman : public ObjectWrap { return ThrowException(Exception::Error(String::New("Not initialized"))); } + ClearErrorOnReturn clear_error_on_return; + (void) &clear_error_on_return; // Silence compiler warning. BIGNUM* key = 0; if (args.Length() == 0) { diff --git a/test/simple/test-crypto.js b/test/simple/test-crypto.js index 01487aca88..1d913fe0b5 100644 --- a/test/simple/test-crypto.js +++ b/test/simple/test-crypto.js @@ -698,10 +698,21 @@ var secret3 = dh3.computeSecret(key2, 'hex', 'base64'); assert.equal(secret1, secret3); +// Run this one twice to make sure that the dh3 clears its error properly +(function() { + var c = crypto.createDecipher('aes-128-ecb', ''); + assert.throws(function() { c.final('utf8') }, /wrong final block length/); +})(); + assert.throws(function() { dh3.computeSecret(''); }, /key is too small/i); +(function() { + var c = crypto.createDecipher('aes-128-ecb', ''); + assert.throws(function() { c.final('utf8') }, /wrong final block length/); +})(); + // Create a shared using a DH group. var alice = crypto.createDiffieHellmanGroup('modp5'); var bob = crypto.createDiffieHellmanGroup('modp5'); @@ -858,11 +869,6 @@ assert.equal(-1, crypto.getHashes().indexOf('SHA1')); assert.equal(-1, crypto.getHashes().indexOf('SHA')); assertSorted(crypto.getHashes()); -(function() { - var c = crypto.createDecipher('aes-128-ecb', ''); - assert.throws(function() { c.final('utf8') }, /invalid public key/); -})(); - // Base64 padding regression test, see #4837. (function() { var c = crypto.createCipher('aes-256-cbc', 'secret');