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

src: limit Buffer::kMaxLength to 1TB #49930

Closed
wants to merge 2 commits into from
Closed

Conversation

targos
Copy link
Member

@targos targos commented Sep 28, 2023

This change has no real effect for now, as the V8 maximum typed array
length is still 2**32. When V8 is updated to version 11.9 or later, the
limit will be 2**53-1 on 64-bit architectures, much larger than any
reasonable amount of RAM. This caps the limit at 1TB, which is already
very large and corresponds to the maximum memory that AddressSanitizer
allows to allocate.

Refs: #49876
Refs: nodejs/node-v8#268

This change has no real effect for now, as the V8 maximum typed array
length is still 2**32. When V8 is updated to version 11.9 or later, the
limit will be 2**53-1 on 64-bit architectures, much larger than any
reasonable amount of RAM. This caps the limit at 1TB, which is already
very large and corresponds to the maximum memory that AddressSanitizer
allows to allocate.

Refs: nodejs#49876
Refs: nodejs/node-v8#268
@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Sep 28, 2023
src/node_buffer.h Outdated Show resolved Hide resolved
src/node_buffer.h Outdated Show resolved Hide resolved
@anonrig anonrig added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Sep 30, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 30, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@targos
Copy link
Member Author

targos commented Sep 30, 2023

I had to push a fixup commit, because v8::TypedArray::kMaxLength is deprecated in V8 11.9 (and for consistency).

@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 30, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 30, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@targos targos marked this pull request as draft October 2, 2023 14:08
@targos
Copy link
Member Author

targos commented Oct 2, 2023

Converted to draft because the issue with ASAN isn't fixed by this and while reducing the limit further would be enough, canary builds show other issues related to this change: nodejs/node-v8#268 (comment)

@targos targos removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 2, 2023
@targos
Copy link
Member Author

targos commented Oct 10, 2023

Will revisit this in the V8 11.9 update PR.

@targos targos closed this Oct 10, 2023
@targos targos mentioned this pull request Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants