diff options
author | Anna Henningsen <anna@addaleax.net> | 2016-08-24 15:14:04 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2016-08-27 16:11:46 +0200 |
commit | 4863f6a1217d1805c4f1a98a32e7774a6379bf5a (patch) | |
tree | 9526a91e700ffd0af0b242d2053952c30ba26d26 /src/stream_base.cc | |
parent | 5bef38b627cd9522d31d1f3ceae6655a06081ed0 (diff) | |
download | android-node-v8-4863f6a1217d1805c4f1a98a32e7774a6379bf5a.tar.gz android-node-v8-4863f6a1217d1805c4f1a98a32e7774a6379bf5a.tar.bz2 android-node-v8-4863f6a1217d1805c4f1a98a32e7774a6379bf5a.zip |
net: make holding the buffer in memory more robust
Set the `req.buffer` property, which serves as a way of keeping
a `Buffer` alive that is being written to a stream, on the C++
side instead of the JS side.
This closes a hole where buffers that were temporarily created
in order to write strings with uncommon encodings (e.g. `hex`)
were passed to the native side without being set as `req.buffer`.
Fixes: https://github.com/nodejs/node/issues/8251
PR-URL: https://github.com/nodejs/node/pull/8252
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/stream_base.cc')
-rw-r--r-- | src/stream_base.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/stream_base.cc b/src/stream_base.cc index 105c4ad458..585b84885c 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -227,6 +227,7 @@ int StreamBase::WriteBuffer(const FunctionCallbackInfo<Value>& args) { err = DoWrite(req_wrap, bufs, count, nullptr); req_wrap_obj->Set(env->async(), True(env->isolate())); + req_wrap_obj->Set(env->buffer_string(), args[1]); if (err) req_wrap->Dispose(); |