nan icon indicating copy to clipboard operation
nan copied to clipboard

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

Open Rush opened this issue 2 years ago • 0 comments

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 https://github.com/nodejs/nan/blob/e14bdcd1f72d62bca1d541b66da43130384ec213/nan.h#L896

The constant is defined here: https://github.com/nodejs/nan/blob/e14bdcd1f72d62bca1d541b66da43130384ec213/nan.h#L417

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

Rush avatar Dec 28 '23 17:12 Rush