Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/node_file.cc')
-rw-r--r--src/node_file.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/node_file.cc b/src/node_file.cc
index 70e57e5a7f1..aff6f27682a 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -1675,7 +1675,7 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
if (is_async) { // write(fd, string, pos, enc, req)
CHECK_NOT_NULL(req_wrap_async);
- len = StringBytes::StorageSize(env->isolate(), value, enc);
+ if (!StringBytes::StorageSize(env->isolate(), value, enc).To(&len)) return;
FSReqBase::FSReqBuffer& stack_buffer =
req_wrap_async->Init("write", len, enc);
// StorageSize may return too large a char, so correct the actual length
@@ -1703,7 +1703,8 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
FSReqWrapSync req_wrap_sync;
FSReqBase::FSReqBuffer stack_buffer;
if (buf == nullptr) {
- len = StringBytes::StorageSize(env->isolate(), value, enc);
+ if (!StringBytes::StorageSize(env->isolate(), value, enc).To(&len))
+ return;
stack_buffer.AllocateSufficientStorage(len + 1);
// StorageSize may return too large a char, so correct the actual length
// by the write size