0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test
Ben Noordhuis 41ec6d0580 dgram: fix regression in string argument handling
v0.10 allows strings for the offset, length and port arguments to
dgram.send() and dgram.sendto() but master before this commit would
abort with the following assert:

    node: ../../src/udp_wrap.cc:227: static void
    node::UDPWrap::DoSend(const v8::FunctionCallbackInfo<v8::Value>&,
    int): Assertion `args[2]->IsUint32()' failed.

Go beyond what v0.10 does and also add range checks: offset and length
should be >= 0, port should be between 1 and 65535.

That particular change needs to be back-ported to v0.10 because passing
a negative offset or length number aborts with the following assertions:

    node: ../../src/udp_wrap.cc:264: static v8::Handle<v8::Value>
    node::UDPWrap::DoSend(const v8::Arguments&, int): Assertion
    `offset < Buffer::Length(buffer_obj)' failed.

Or:

    node: ../../src/udp_wrap.cc:265: static v8::Handle<v8::Value>
    node::UDPWrap::DoSend(const v8::Arguments&, int): Assertion
    `length <= Buffer::Length(buffer_obj) - offset' failed.

Interestingly enough, a negative port number is accepted in v0.10 but
is silently ignored.

This commit exposed a bug in the simple/test-dgram-close test which
has also been fixed.
2013-08-09 03:05:46 +02:00
..
addons
disabled test: Move test-http-default-port from disabled to simple 2013-08-05 12:55:31 -07:00
fixtures src: break on uncaught exception 2013-06-26 19:54:31 +02:00
gc test: fix up weakref.cc after v8 api change 2013-07-06 17:44:45 +02:00
internet https: fix default port 2013-08-05 12:53:12 -07:00
message process: remove maxTickDepth from _tickCallback 2013-05-30 09:30:19 -07:00
pummel Merge remote-tracking branch 'upstream/v0.10' 2013-08-06 11:59:17 -07:00
simple dgram: fix regression in string argument handling 2013-08-09 03:05:46 +02:00
common.js