Skip to content

Error when creating external buffers: Check failed: length == backing_store->byte_length() #32083

@ZFail

Description

@ZFail
  • Version: 13.3.0
  • Platform: Windows7 x64 and Ubuntu18 x64

What steps will reproduce the bug?

Error occurs when creating external buffer (node::Buffer::New) over existing node buffer with different size, this mechanism is used in the node-ffi library.
Simple reproducer:

git clone https://github.com/ZFail/node-addon-examples
cd node-addon-examples
git checkout d1b2b7505337411ecfdcdf1d6bfc4d1aaa923a1f
cd 2_function_arguments
cd node-addon-api
yarn install
node addon.js

What is the expected behavior?

output must be:

This should be 0123456789012345: 0123456789012345
This should be 01: 01
This should be 0123: 0123

What do you see instead?

This should be 0123456789012345: 0123456789012345


#
# Fatal error in , line 0
# Check failed: length == backing_store->byte_length().
#
#
#
#FailureMessage Object: 00000000001ADF80

Additional information

Seems like an error in the LookupOrCreateBackingStore function in v8. We should not do a BackingStore lookup for an external buffer.
https://github.com/nodejs/node/blob/master/deps/v8/src/api/api.cc#L7281

Metadata

Metadata

Assignees

No one assigned

    Labels

    addonsIssues and PRs related to native addons.bufferIssues and PRs related to the buffer subsystem.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions