dgram: don't assert on send('string')
authorBen Noordhuis <info@bnoordhuis.nl>
Tue, 8 Jan 2013 03:27:34 +0000 (04:27 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Tue, 8 Jan 2013 03:32:40 +0000 (04:32 +0100)
commitad6769fc92ed21c9d4a62719ed9d46538dc5a73b
treeb1b3916dec11564f5d2069cc333d8515835c85ae
parent872cb0d7fabdb23ad3378d28103228bc58218235
dgram: don't assert on send('string')

Raise a TypeError when the argument to send() or sendto() is anything
but a Buffer.

Fixes the following assertion:

  $ node -e 'require("dgram").createSocket("udp4").send("BAM")'
  node: ../../src/udp_wrap.cc:220: static v8::Handle<v8::Value>
  node::UDPWrap::DoSend(const v8::Arguments&, int): Assertion
  `Buffer::HasInstance(args[0])' failed.
  Aborted (core dumped)

Fixes #4496.
lib/dgram.js
test/simple/test-dgram-regress-4496.js [new file with mode: 0644]