Skip to content

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

@Rush

Description

@Rush

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions