Skip to content

perf_hooks: copy shared data before importing histograms - #67249

Closed
adityareddy-dev wants to merge 1 commit into
nodejs:mainfrom
adityareddy-dev:fix/histogram-import-shared-buffer
Closed

adityareddy-dev wants to merge 1 commit into
nodejs:mainfrom
adityareddy-dev:fix/histogram-import-shared-buffer

Conversation

@adityareddy-dev

@adityareddy-dev adityareddy-dev commented Nov 4, 2026 •

Copy link
Copy Markdown

importHistogram() reads the input several times while parsing CBOR. Copy SharedArrayBuffer-backed input first so concurrent worker writes cannot change the bytes during parsing, following the existing approach in Buffer.toString().

Fixes: #67152

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

Caution

AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context.

Copy SharedArrayBuffer-backed input before parsing its CBOR data so
concurrent worker writes cannot change the bytes during parsing.

Fixes: nodejs#67152

Signed-off-by: Aditya Reddy <82123567+adityareddy-dev@users.noreply.github.com>
@adityareddy-dev
adityareddy-dev force-pushed the fix/histogram-import-shared-buffer branch from d7a5c02 to 52b15ac Compare November 4, 2026 12:43
@MikeMcC399

This comment was marked as outdated.

@adityareddy-dev

Copy link
Copy Markdown
Author

Thanks Mike, that makes sense. Closing this one for now and keeping #67243 open until it lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentscan:automated-account 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.

perf_hooks: Histogram.DoImport reads SharedArrayBuffer-backed data without copying (TOCTOU)

3 participants