Nan is enforcing wrong ~1GB kMaxLength for Nan::NewBuffer, should be 4GB
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 531
- Avg merge
- 21m
- Merged PRs (30d)
- 1
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in nan.h around the constant definition at line 417 and the NewBuffer check around lines 896 and 939. Compare the limit with Node.js buffer.constants.MAX_LENGTH; the issue is done when the check permits the reported supported maximum and the relevant project validation passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, node.js
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100