0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

10588 Commits

Author SHA1 Message Date
Ben Noordhuis
78e38f59ad src: fix uninitialized memory dereference
The elements of the heap-allocated TaskQueue::ring_ array in
src/node_v8_platform.cc were compared against without being
initialized first.

Fixes node-forward/node#33.

PR-URL: https://github.com/node-forward/node/pull/34
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-28 12:42:14 +01:00
cjihrig
c2b4f4809b net: add pauseOnConnect option to createServer()
Currently when a server receives a new connection the underlying socket
handle begins reading data immediately. This causes problems when
sockets are passed between processes, as data can be read by the first
process and thus never read by the second process.

This commit allows sockets that are constructed with a handle to be
paused initially.

PR-URL: https://github.com/joyent/node/pull/8576
Fixes: https://github.com/joyent/node/issues/7905
Fixes: https://github.com/joyent/node/issues/7784
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-10-27 14:11:20 -07:00
Vladimir Kurchatkin
15aa47e261 docs: fix smalloc.dispose() example
Also couple of additions about dispose and limitations of smalloc'ed
objects.

Fixes: https://github.com/joyent/node/pull/8625
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-10-27 12:58:05 -07:00
Ben Noordhuis
081e94a90d doc: update compiler requirements in README
The latest V8 upgrade and the C++11-ification of the source code in src/
requires a recent compiler.  Update the requirements in the README.

Fixes node-forward/node#35.

PR-URL: https://github.com/node-forward/node/pull/36
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-27 18:24:06 +01:00
Trevor Norris
6a68d64629 lint: fix whitespace issues
Fixes: f6e5740 "path: resolve normalize drive letter to lower case"
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-10-25 14:27:23 -07:00
Nikolai Vavilov
b105f6f741 src: fix comparison of WCHAR with nullptr
PR-URL: https://github.com/node-forward/node/pull/32
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-10-25 01:29:55 +02:00
Fedor Indutny
be17aa4385 Merge remote-tracking branch 'origin/v0.12' into v0.12
Conflicts:
	src/cares_wrap.cc
	src/env-inl.h
	src/env.h
	src/node.cc
	src/node.h
	src/node_crypto.cc
2014-10-24 17:08:37 +04:00
Ben Noordhuis
8a00961b81 src: mark more destructors with override keyword
The previous commits fixed oversights in destructors that should have
been marked virtual but weren't.  This commit marks destructors from
derived classes with the override keyword.
2014-10-23 22:50:00 +02:00
Ben Noordhuis
d2131b7406 src: mark SSLWrap destructor as virtual
Like the previous commit but this time for the SSLWrap destructor.
2014-10-23 22:50:00 +02:00
Ben Noordhuis
53a26d83f4 src: mark BaseObject destructor as virtual
Like the previous commit but this time for the BaseObject destructor.
2014-10-23 22:50:00 +02:00
Ben Noordhuis
f874855d2e src: mark AsyncWrap destructor as virtual
Make AsyncWrap::~AsyncWrap() virtual, otherwise it is unsafe to delete
a derived class through a pointer to AsyncWrap.  Fortunately, we don't
do that anywhere right now; this commit is merely a preemptive bug fix.
2014-10-23 22:49:59 +02:00
Ben Noordhuis
5ab87dba73 src: mark empty destructors as default
Mark empty destructors as having a default no-op implementation.
Remove a few unused constructors and destructors while we are here.
2014-10-23 22:49:59 +02:00
Ben Noordhuis
c038dcc360 src: update DISALLOW_COPY_AND_ASSIGN() to c++11
Mark the matrix of copy/move constructor/assignment operator as deleted.
Prevents the object from being copied around (the macro already did that
pre-C++11), but also from being moved out.
2014-10-23 22:49:59 +02:00
Ben Noordhuis
9f5800ab81 src: mark virtual functions with override keyword
Add `override` keywords where appropriate.  Makes maintenance easier
because the compiler will shout at you when a base class changes in
an incompatible way.
2014-10-23 22:49:59 +02:00
Ben Noordhuis
b33a87d8cb src: remove STATIC_ASSERT() macro
This macro does not not rightfully belong in node.h, remove it.
Replace the one use site with a C++11 `static_assert` construct.
2014-10-23 22:49:58 +02:00
Ben Noordhuis
2d82cdf670 src: replace NULL with nullptr
Now that we are building with C++11 features enabled, replace use
of NULL with nullptr.

The benefit of using nullptr is that it can never be confused for
an integral type because it does not support implicit conversions
to integral types except boolean - unlike NULL, which is defined
as a literal `0`.
2014-10-23 22:49:58 +02:00
dead-horse
f6e5740180 path: resolve normalize drive letter to lower case
make path.resolve work the same as path.normalize
2014-10-20 20:48:00 +02:00
Rod Vagg
b2b59febe8 etw: use Isolate to SetJitCodeEventHandler
PR-URL: https://github.com/node-forward/node/pull/27
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-18 04:00:18 +02:00
Rod Vagg
05daf5f7b7 test: allow common.PIPE to be configured via env
Add optional env var $NODE_COMMON_PIPE for setting common.PIPE to
manually deal with maximum path lengths for unix sockets.

PR-URL: https://github.com/node-forward/node/pull/26
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-10-18 03:56:09 +02:00
Ben Noordhuis
3a786d3d88 build: remove workarounds for gcc <= 4.4
Now that V8 requires a compiler with decent C++11 support, there is no
reason to keep supporting old versions of gcc.  Remove workarounds for
bugs in gcc 4.4 and older.

This coincidentally makes it easier to build with clang 3.3 + address
sanitizer because clang no longer chokes on the `-fno-tree-vrp` switch.

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-16 22:39:40 +02:00
Ben Noordhuis
ff7c68c4da build: add asan option to multi-arch/mode build
Make it possible to build node against Address Sanitizer.  Enable with:

    $ make -f Makefile.build asan=clang++ CC=clang CC_host=clang

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-16 22:39:38 +02:00
Ben Noordhuis
edaf7af30b test: make test runner multi-arch/mode compatible
Make `python tools/test.py --arch=ia32,x64 --mode=debug,release` work.
The test runner looks for the `node` binary in `out/${arch}.${mode}/`.

Running tools/test.py without --arch makes it use `out/Release/node` or
`out/Debug/node` like before.

This commit removes `test/simple/test-executable-path.js` because the
assumptions it makes about the locations of the debug and release
binaries are now outdated.

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-16 22:39:34 +02:00
Ben Noordhuis
5ec2b3fc3d build: set up basic multi-arch/mode build
Make `make -f Makefile.build ia32.release x64.debug` work.  It's not
perfect yet: it requires running `./configure` first and the generated
`config.gypi` is shared across builds.

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-16 22:39:30 +02:00
Ben Noordhuis
91b249262b build: copy V8 makefile to top-level directory
Will be used as the template for a multi-arch, multi-mode build system.

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-16 22:39:26 +02:00
Ben Noordhuis
a08f8e28ca build: add x32 support
This commit adds preliminary x32 support.  Configure with:

    $ ./configure --dest-cpu=x32

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-16 22:39:17 +02:00
Ben Noordhuis
7af8870af9 deps: fix v8 x32 build
Fix double definition errors in the libv8_base.a library target by
compiling out stub functions when building for x32.

This fix is incomplete because, although V8 now builds, it makes a
number of bad assumptions about the size of stack slots, see
https://code.google.com/p/v8/issues/detail?id=3630.

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-16 22:38:43 +02:00
Ben Noordhuis
1f11983350 test: fix non-determinism in test-crypto-domains
The test implicitly assumed that crypto operations complete in the same
order as they are started but, because they go round-trip through the
thread pool, there is no such guarantee.  Enforce proper sequencing.

Fixes node-forward/node#22.

PR-URL: https://github.com/node-forward/node/pull/23
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-16 03:56:28 +02:00
Ben Noordhuis
d3c317e08a src: attach env directly to api functions
Attach the per-context execution environment directly to API functions.
Rationale:

 * Gets node one step closer to multi-isolate readiness.

 * Avoids multi-context confusion, e.g. when the caller and callee live
   in different contexts.

 * Avoids expensive calls to pthread_getspecific() on platforms where
   V8 does not know how to use the thread-local storage directly.
   (Linux, the BSDs.)

PR-URL: https://github.com/node-forward/node/pull/18
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-13 23:46:46 +04:00
Ben Noordhuis
b45d33617b src: remove unused Environment::GetCurrent() calls
Remove a few Environment::GetCurrent() calls that g++ failed to detect
were not used for anything.  The return value was assigned to a local
variable but not used meaningfully.

PR-URL: https://github.com/node-forward/node/pull/18
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-13 23:46:43 +04:00
Ben Noordhuis
1325335022 src: remove unused MIN macro
Defined in src/node.cc but not actually in use; remove it.

PR-URL: https://github.com/node-forward/node/pull/18
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-13 23:46:39 +04:00
Ben Noordhuis
8f6c5870cc src: ignore risky env vars when setuid root
On POSIX platforms, check that the uid and gid match the euid and egid
respectively before looking up the environment variable.

Before this commit, an i18n-enabled suid node would cheerfully load
attacker-controlled ICU data through the NODE_ICU_DATA environment
variable.

This commit is not a complete fix.  For example, it's up for debate
what to do with the NODE_CHANNEL_FD environment variable.

PR-URL: https://github.com/node-forward/node/pull/18
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-13 23:46:21 +04:00
Ben Noordhuis
5fdff3854a src: replace assert() with CHECK()
Mechanically replace assert() statements with UNREACHABLE(), CHECK(),
or CHECK_{EQ,NE,LT,GT,LE,GE}() statements.

The exceptions are src/node.h and src/node_object_wrap.h because they
are public headers.

PR-URL: https://github.com/node-forward/node/pull/16
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-12 02:09:46 +04:00
Ben Noordhuis
75a461d099 src: fix up imports
Make tools/check-imports.sh stop complaining, remove or reorder 'using'
statements.

PR-URL: https://github.com/node-forward/node/pull/16
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-12 02:09:44 +04:00
Ben Noordhuis
97585b0d7a src: remove unnecessary HandleScopes
API callback functions don't need to create a v8::HandleScope instance
because V8 already creates one in the JS->C++ adapter frame.

PR-URL: https://github.com/node-forward/node/pull/16
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-12 02:09:16 +04:00
Refael Ackermann
b2e519983f deps: fix postmortem-metadata generator in v8
Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/8476
2014-10-12 02:05:02 +04:00
Fedor Indutny
a48583e8d7 test: fix error messages after v8 upgrade 2014-10-12 02:05:02 +04:00
Fedor Indutny
e43c109891 gyp: build with gnu++0x for the sake of new v8
The new v8 doesn't build on non gnu++0x, set it to a proper value for
all systems.
2014-10-12 02:05:02 +04:00
Fedor Indutny
50839a042e v8_platform: provide default v8::Platform impl
Provide default Platform implementation for v8's purposes.
2014-10-12 02:05:02 +04:00
Alexis Campailla
d22637c36c build: vcbuild fix "The input line is too long."
vcbuild.bat is calling vcvars.bat, which doesn't detect if the environment
has already been set. This causes repeated entries to be added to the PATH,
which after a few invocations will lead to an error:
The input line is too long.
2014-10-10 15:14:47 +02:00
Fedor Indutny
6bcea4ff93 deps: update v8 to 3.29.93.1 2014-10-10 14:49:02 +04:00
Brian White
874dd590cf streams: make setDefaultEncoding() throw
PR-URL: https://github.com/joyent/node/pull/8529
Fixes: f04f3a0 "streams: set default encoding for writable streams"
[trev.norris@gmail.com: update tests to check if throws]
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-10-09 16:48:59 -07:00
Ben Noordhuis
4fae2356d1 freebsd,linux,sunos: make stack non-executable
Link with -z,noexecstack to make stack memory non-executable.  Makes
shellcode injection through buffer overflows more difficult.

Fixes: https://github.com/joyent/node/issues/7542
PR-URL: https://github.com/node-forward/node/pull/8
Reviewed-By: Trevor Norris <trevnorris@gmail.com>
2014-10-09 23:33:00 +02:00
Ben Noordhuis
6d2ac2bd54 crypto: update root certificates
Update the list of root certificates in src/node_root_certs.h with
tools/mk-ca-bundle.pl.

PR-URL: https://github.com/node-forward/node/pull/7
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Trevor Norris <trevnorris@gmail.com>
2014-10-09 23:25:24 +02:00
Ben Noordhuis
a7d96d4c56 tools: update certdata.txt
This is the latest certdata.txt from [0], last updated on 2014-10-08.

[0] https://hg.mozilla.org/mozilla-central/raw-file/f0bb13ef0ee4/security/nss/lib/ckfw/builtins/certdata.txt

PR-URL: https://github.com/node-forward/node/pull/7
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Trevor Norris <trevnorris@gmail.com>
2014-10-09 23:23:59 +02:00
Ray Donnelly
eccb101193 build: determine and use EXEEXT on windows
PR-URL: https://github.com/joyent/node/pull/8294
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-10 01:21:12 +04:00
Ray Donnelly
6f94b3db91 src: fixes for win32
Update following macros:

* NODE_NET_SOCKET_{READ,WRITE}() - they both take 4 arguments,
  not 2

* NODE_COUNT_GC_PERCENTTIME() - it takes a single argument.

Use INT_PTR instead of INT32 in pointer casts in win32_etw provider.

PR-URL: https://github.com/joyent/node/pull/8294
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-10 01:20:04 +04:00
Julien Gilli
011319e248 build: fix build for SmartOS
This change in V8: https://code.google.com/p/v8/source/detail?r=22210
has introduced a method named OS::GetCurrentThreadId which fails to
compile on OSes where a "gettid" syscall does not exist.
This build issue has been fixed upstream by another change:
https://code.google.com/p/v8/source/detail?r=23459. This commit
integrates this fix. It's still not clear if this is good enough for the
long term, see https://code.google.com/p/v8/issues/detail?id=3620 for
more information.

The other build issue was due to the fact that alloca.h is not included
by other system includes on SmartOS, which is assumed by V8.

PR-URL: https://github.com/joyent/node/pull/8534
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-10-10 00:53:56 +04:00
Wang Xinyong
db7df57e03 doc: correct createSecureContext
Remove incorrect stablity indication of tls.createSecureContext, and
format stablity indication of crypto.createCredentials.

Fixes: e50749 "doc: document `tls.createSecureContext`"
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-10-09 11:46:58 -07:00
Alexis Campailla
61dd74bc5d test: fix test-child-process-spawn-typeerror
You cannot spawn 'dir' on Windows because it's not an executable.  Also,
some people might have 'ls' on their path on Windows, so I changed
invalidCmd to something that's highly unlikely to exist.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-10-09 09:38:17 -07:00
Stiliyan Lazarov
47f119cabf doc: fix wording and punctuation in modules
[trev.norris@gmail.com: break lines at 80 characters]
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-10-08 16:48:31 -07:00