7205 Commits

Author SHA1 Message Date
Fedor Indutny
396b9deacd deps: throw StackOverflow in JSON.parse
Backport of:

fc6343a79274b6a1e99037ebb131096e2da05306

from v8 upstream.

Original commit message:

    Catch stack overflow in JSON.parse.

    BUG=

    Review URL: https://chromiumcodereview.appspot.com/11275039

    git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@12816 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-08-11 17:38:09 +04:00
Timothy J Fontaine
8fd350e357 Now working on 0.8.29 2014-07-31 11:40:01 -07:00
Timothy J Fontaine
418fc1a4d6 Merge branch 'v0.8.28-release' into v0.8 2014-07-31 11:39:39 -07:00
Timothy J Fontaine
643a21c097 build: run wix tool chain out of process
Building MSIs for different arch's can sometimes confuse MSBuild and
Wix, isntead run the toolchain externally so we don't have to worry
about which arch cmd.exe is running as.
v0.8.28
2014-07-31 11:17:31 -07:00
Timothy J Fontaine
0c766cbdfe 2014.07.31, Version 0.8.28 (maintenance)
* v8: Interrupts must not mask stack overflow. (Fedor Indutny)
2014-07-31 10:34:44 -07:00
Fedor Indutny
895c3647a2 v8: Interrupts must not mask stack overflow.
Backport of https://codereview.chromium.org/339883002
2014-07-31 10:27:50 -07:00
Timothy J Fontaine
d5edd68794 Now working on 0.8.28 2014-06-16 10:35:12 -05:00
Timothy J Fontaine
d3ff648997 Merge branch 'v0.8.27-release' into v0.8 2014-06-16 10:34:47 -05:00
Timothy J Fontaine
a69205346b build: support individual signing keys v0.8.27 2014-06-09 12:44:26 -07:00
Timothy J Fontaine
eeb08ca496 2014.06.09, Version 0.8.27 (maintenance)
* openssl: update to 1.0.0m (CVE-2014-0224)

* utf8: Prevent Node from sending invalid UTF-8 (Felix Geisendörfer)
  - *NOTE* this introduces a breaking change, previously you could construct
invalid UTF-8 and invoke an error in a client that was expecting valid
UTF-8, now unmatched surrogate pairs are replaced with the unknown UTF-8
character. To restore the old functionality simply have NODE_INVALID_UTF8
environment variable set.

* tls: fix pool usage race (Fedor Indutny)

* fs: close file if fstat() fails in readFile() (cjihrig)
2014-06-09 11:05:29 -07:00
Timothy J Fontaine
f82652e68e openssl: regenerate asm 2014-06-06 15:04:40 -07:00
Matt Caswell
737ba482cb openssl: apply upstream ccb0398 commit
Fixed Windows compilation failure
2014-06-06 15:04:40 -07:00
Timothy J Fontaine
650d1355a5 openssl: update to 1.0.0m 2014-06-06 15:04:39 -07:00
Timothy J Fontaine
15f0e0a596 src: replace usage of String::Utf8Value
v8::String::Utf8Value previously could allow invalid surrogates when
interpreting values.
2014-06-06 15:04:39 -07:00
Felix Geisendörfer
066e97867a string_bytes: Guarantee valid utf-8 output
Previously v8's WriteUtf8 function would produce invalid utf-8 output
when encountering unmatched surrogate code units [1]. The new
REPLACE_INVALID_UTF8 option fixes that by replacing invalid code points
with the unicode replacement character.

[1]: JS Strings are defined as arrays of 16 bit unsigned integers. There
is no unicode enforcement, so one can easily end up with invalid unicode
code unit sequences inside a string.
2014-06-06 15:04:39 -07:00
Felix Geisendörfer
11d21f5b17 deps/v8: Apply REPLACE_INVALID_UTF8 patch
- https://codereview.chromium.org/121173009/
- https://code.google.com/p/v8/source/detail?r=18683

Note: The v8 test case did not cleanly apply, so it's missing from this
patch. I'm assuming this is not a problem if the v8 test suite is not
part of the node build / test system. If that's the case I'll fix it.
Otherwise the test case will be integrated once v8 is upgraded.
2014-06-06 15:04:39 -07:00
Felix Geisendörfer
0dc2f4f82d string_decoder: Add more comments 2014-06-06 15:04:39 -07:00
Felix Geisendörfer
f59ec645cb string_decoder: Fix failures from new test cases
This patch simplifies the implementation of StringDecoder, fixes the
failures from the new test cases, and also no longer relies on v8's
WriteUtf8 function to encode individual surrogates.
2014-06-06 15:04:39 -07:00
Felix Geisendörfer
d55702e73d string_decoder: Improve test coverage
The test cases are still essentially the same, but now all possible ways
of writing a buffer into the decoder are tested, which has exposed a few
failing scenarios that had not been discovered so far!
2014-06-06 15:04:39 -07:00
Timothy J Fontaine
654267609b src: avoid extra syscalls during node init 2014-06-06 15:04:38 -07:00
cjihrig
b93a51e3a6 fs: close file if fstat() fails in readFile()
Currently, if fstat() fails in readFile(), the callback
is invoked without closing the file. This commit closes
the file before calling back.

Closes #7697
2014-05-28 18:58:57 -07:00
Fedor Indutny
10b6156bd2 tls: fix pool usage race
When calling `encOut` in loop, `maybeInitFinished()` may invoke
`clearOut`'s loop, leading to the writing of interleaved data
(encrypted and cleartext) into the one shared pool.

Move `maybeInitFinished()` out of the loop and add assertion for
future.

backport of 60f777d
2014-01-08 23:06:49 +04:00
Eugene Girshov
1e9ad1f6a4 test: fix http backpressure test case
- use socket timeout event,
- pause socket from the client side.
2013-11-07 12:30:22 +04:00
Fedor Indutny
532f9ffca2 v8: backport b3775cf3 from upstream 2013-10-31 15:09:16 +04:00
Timothy J Fontaine
23c608ad40 Now working on 0.8.27 2013-10-18 14:54:55 -07:00
Timothy J Fontaine
faa042b4e4 Merge branch 'v0.8.26-release' into v0.8 2013-10-18 14:54:23 -07:00
Timothy J Fontaine
4421bebc36 2013.10.13, Version 0.8.26 (maintenance)
* v8: Upgrade to 3.11.10.26

* crypto: clear openssl error stack when handled (Ben Noordhuis)

* crypto: clear errors from verify failure (Timothy J Fontaine)

* crypto: fix memory leak in LoadPKCS12 (Fedor Indutny)

* http: provide backpressure for pipeline flood (isaacs)

* http_parser: expose pause/resume method for parser (Timothy J Fontaine)

* readline: pause stdin before turning off terminal raw mode (Daniel Chatfield)
2013-10-18 10:34:55 -07:00
Ben Noordhuis
78fe7d0592 crypto: clear openssl error stack when handled
Clear OpenSSL's error stack on return from Connection::HandleSSLError().
This stops stale errors from popping up later in the lifecycle of the
SSL connection where they would cause spurious failures.

This commit causes a 1-2% performance regression on `make bench-tls`.
We'll address that in follow-up commits if possible but let's ensure
correctness first.

Backport of c6e2db2
2013-10-18 10:07:49 -07:00
Timothy J Fontaine
c421a5e66b crypto: clear errors from verify failure
OpenSSL will push errors onto the stack when a verify fails, which can
disrupt TLS and other routines if we don't clear the error stack

Fixes #6304
2013-10-18 08:56:35 -07:00
isaacs
653d4db71f http: provide backpressure for pipeline flood
If a client sends a lot more pipelined requests than we can handle, then
we need to provide backpressure so that the client knows to back off.
Do this by pausing both the stream and the parser itself when the
responses are not being read by the downstream client.

Backport of 085dd30
2013-10-18 08:36:45 -07:00
Timothy J Fontaine
826661f33a http_parser: expose pause/resume method for parser 2013-10-16 13:18:06 -07:00
Daniel Chatfield
98a9089f5f readline: pause stdin before turning off terminal raw mode
On windows, libuv will immediately make a `ReadConsole` call (in the
thread pool) when a 'flowing' `uv_tty_t` handle is switched to
line-buffered mode. That causes an immediate issue for some users,
since libuv can't cancel the `ReadConsole` operation on Windows 8 /
Server 2012 and up if the program switches back to raw mode later.

But even if this will be fixed in libuv at some point, it's better to
avoid the overhead of starting work in the thread pool and immediately
cancelling it afther that.

See also f34f1e3, where the same change is made for the opposite
flow, e.g. move `resume()` after `_setRawMode(true)`.

Fixes #5927

This is a backport of dfb0461 (see #5930) to the v0.8 branch.
2013-08-17 15:41:03 +02:00
Fedor Indutny
42f926ece7 crypto: fix memory leak in LoadPKCS12
X509_STORE_add_cert increment reference of passed `x509` cert,
`X509_free` must be called to avoid memory leak.

This is a back-port of commit c1db1ec from the master branch.
2013-07-29 13:20:20 +04:00
isaacs
ccad4c7fbc V8 build: 'echo -n' considered harmful 2013-06-26 08:16:15 -07:00
Ben Noordhuis
ca3976726b v8: remove optimization switches
Remove compiler switches from $(TOPLEVEL)/deps/v8/build/common.gypi, we set
them globally in $(TOPLEVEL)/common.gypi.

Commit 29d12c73 accidentally reintroduced the switches again. In particular,
the 'cflags!': ['-O2','-Os'] section forced building V8 without any
optimizations, resulting in a steep (~66%) performance drop on some benchmarks.

Fixes #4191.
2013-06-26 08:16:10 -07:00
isaacs
c86b3815b5 V8: Reapply patches 2013-06-26 08:16:05 -07:00
isaacs
1111880df4 v8: Upgrade to 3.11.10.26 2013-06-26 08:15:09 -07:00
isaacs
1a39380ab4 Now working on 0.8.26 2013-06-13 13:21:50 -07:00
isaacs
7f52ee086a Merge branch 'v0.8.25-release' into v0.8 2013-06-13 13:21:31 -07:00
isaacs
0b9bdb2bc7 2013.06.13, Version 0.8.25 (maintenance)
* npm: Upgrade to 1.2.30

* child_process: fix handle delivery (Ben Noordhuis)
v0.8.25
2013-06-13 11:49:15 -07:00
isaacs
a0837fd32e npm: Upgrade to 1.2.30 2013-06-12 11:00:38 -07:00
Ben Noordhuis
8a3d0c8b91 child_process: fix handle delivery
node.js and libuv depend on the fact that none of the supported systems
ever emit more than one SCM_RIGHTS message from a recvmsg() syscall.

SCM_RIGHTS messages are never coalesced. SCM_RIGHTS and normal messages
however _are_ coalesced. That is, recvmsg() might return this:

  recvmsg();  // { "message-with-fd", "message", "message" }

The operating system implicitly breaks pending messages along
SCM_RIGHTS boundaries. Most Unices break before such messages but Linux
also breaks _after_ them.  When the sender looks like this:

  sendmsg("message");
  sendmsg("message-with-fd");
  sendmsg("message");

Then on most Unices the receiver sees messages arriving like this:

  recvmsg();  // { "message" }
  recvmsg();  // { "message-with-fd", "message" }

The bug fix in commit 9352c19 assumes this behavior. On Linux however,
those messages can also come in like this:

  recvmsg();  // { "message", "message-with-fd" }
  recvmsg();  // { "message" }

In other words, it's incorrect to assume that the file descriptor is
always attached to the first message. This commit makes node wise up.

This is a back-port of commit 21bd456 from the v0.10 branch. The test
has been dropped as it's not compatible with the v0.8 process model.

Fixes #5330.

Conflicts:
	lib/child_process.js
2013-06-06 17:42:07 +02:00
isaacs
bf16141eeb npm: Upgrade to 1.2.27 2013-06-06 14:44:10 -07:00
isaacs
6fad535c63 Now working on v0.8.25 2013-06-04 11:11:55 -07:00
isaacs
01626461e3 Merge branch 'v0.8.24-release' into v0.8 2013-06-04 11:11:34 -07:00
isaacs
c1a1ab0677 2013.06.04, Version 0.8.24 (maintenance)
* npm: Upgrade to v1.2.24

* url: Properly parse certain oddly formed urls (isaacs)

* http: Don't try to destroy nonexistent sockets (isaacs)

* handle_wrap: fix NULL pointer dereference (Ben Noordhuis)
v0.8.24
2013-06-03 16:53:09 -07:00
isaacs
71091f78f2 npm: Upgrade to 1.2.24 2013-06-03 16:51:23 -07:00
isaacs
ba0ed00b5f url: Properly parse certain oddly formed urls
In cases where there are multiple @-chars in a url, Node currently
parses the hostname and auth sections differently than web browsers.

This part of the bug is serious, and should be landed in v0.10, and
also ported to v0.8, and releases made as soon as possible.

The less serious issue is that there are many other sorts of malformed
urls which Node either accepts when it should reject, or interprets
differently than web browsers.  For example, `http://a.com*foo` is
interpreted by Node like `http://a.com/*foo` when web browsers treat
this as `http://a.com%3Bfoo/`.

In general, *only* the `hostEndingChars` should be the characters that
delimit the host portion of the URL.  Most of the current `nonHostChars`
that appear in the hostname should be escaped, but some of them (such as
`;` and `%` when it does not introduce a hex pair) should raise an
error.

We need to have a broader discussion about whether it's best to throw in
these cases, and potentially break extant programs, or return an object
that has every field set to `null` so that any attempt to read the
hostname/auth/etc. will appear to be empty.
2013-06-03 16:29:10 -07:00
isaacs
4dc5b13861 http: Don't try to destroy nonexistent sockets
Fixes #3740

In the case of pipelined requests, you can have a situation where
the socket gets destroyed via one req/res object, but then trying
to destroy *another* req/res on the same socket will cause it to
call undefined.destroy(), since it was already removed from that
message.

Add a guard to OutgoingMessage.destroy and IncomingMessage.destroy
to prevent this error.
2013-04-22 09:56:48 -07:00
Ben Noordhuis
600cd28167 test: make stdout-close-unref work in test runner
process.stdout isn't fully initialized yet by the time the test starts
when invoked with `python tools/test.py`. Use process.stdin instead and
force initialization with process.stdin.resume().

This is a back-port of commit 2e70dda from the v0.10 branch.
2013-04-18 00:05:31 +02:00