Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nan is enforcing wrong ~1GB kMaxLength for Nan::NewBuffer, should be 4GB #964

Open
Rush opened this issue Dec 28, 2023 · 0 comments
Open

Comments

@Rush
Copy link
Contributor

Rush commented Dec 28, 2023

This resulted in a real-world application issue:

[1] Assertion failed: (size <= imp::kMaxLength && "too large buffer"), function NewBuffer, file nan.h, line 939.

Buffers of 1GB are definitely realistic when dealing with >4k visual data.

The check is implemented here

nan/nan.h

Line 896 in e14bdcd

assert(length <= imp::kMaxLength && "too large buffer");

The constant is defined here:

nan/nan.h

Line 417 in e14bdcd

static const size_t kMaxLength = 0x3fffffff;

I believe it should be 4GB as reported by buffer.constants.MAX_LENGTH (https://nodejs.org/api/buffer.html#bufferkmaxlength)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant