diff --git a/lib/net.js b/lib/net.js index b79dbbd545c..cd83b157207 100644 --- a/lib/net.js +++ b/lib/net.js @@ -244,6 +244,7 @@ Object.defineProperty(Stream.prototype, 'readyState', { Stream.prototype._appendBucket = function (data, encoding, fd) { + // TODO reject empty data. var newBucket = { data: data }; if (encoding) newBucket.encoding = encoding; if (fd) newBucket.fd = fd; diff --git a/src/node_io_watcher.cc b/src/node_io_watcher.cc index 298a35b9f28..a991dd9a8f7 100644 --- a/src/node_io_watcher.cc +++ b/src/node_io_watcher.cc @@ -335,6 +335,8 @@ void IOWatcher::Dump(EV_P_ ev_prepare *w, int revents) { size_t l = Buffer::Length(buf_object); + if (l == 0) continue; + assert(first_offset < l); iov[iovcnt].iov_base = Buffer::Data(buf_object) + first_offset; iov[iovcnt].iov_len = l - first_offset;