Skip to content

Commit

Permalink
node-api: make napi_get_buffer_info check if passed buffer is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
Janrupf committed Jan 26, 2024
1 parent 09da597 commit 4c44035
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,7 @@ napi_status NAPI_CDECL napi_get_buffer_info(napi_env env,
CHECK_ARG(env, value);

v8::Local<v8::Value> buffer = v8impl::V8LocalValueFromJsValue(value);
RETURN_STATUS_IF_FALSE(env, buffer->IsArrayBuffer(), napi_invalid_arg);

if (data != nullptr) {
*data = node::Buffer::Data(buffer);
Expand Down

0 comments on commit 4c44035

Please sign in to comment.