Skip to content

src: avoid union type-punning in trace values - #65933

Open
XadillaX wants to merge 1 commit into
nodejs:mainfrom
XadillaX:fix-trace-value-union-ub
Open

src: avoid union type-punning in trace values#65933
XadillaX wants to merge 1 commit into
nodejs:mainfrom
XadillaX:fix-trace-value-union-ub

Conversation

@XadillaX

@XadillaX XadillaX commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Replace TraceValueUnion with memcpy-based object representation copying to avoid reading inactive union members. Generalize integral values to support all integral and enum types.

This follows the equivalent V8 fix in CL 1886918.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/1886918
Fixes: #57033

Replace TraceValueUnion with memcpy-based object representation copying
to avoid reading inactive union members. Generalize integral values to
support all integral and enum types.

This follows the equivalent V8 fix in CL 1886918.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/1886918
Fixes: nodejs#57033
Signed-off-by: XadillaX <i@2333.moe>
@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 Sep 9, 2026
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.16%. Comparing base (b3fb344) to head (3c837ec).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65933      +/-   ##
==========================================
- Coverage   90.16%   90.16%   -0.01%     
==========================================
  Files         771      771              
  Lines      265434   265436       +2     
  Branches    50450    50447       -3     
==========================================
- Hits       239332   239322      -10     
- Misses      17045    17064      +19     
+ Partials     9057     9050       -7     
Files with missing lines Coverage Δ
src/tracing/trace_event_legacy_inl.h 79.50% <100.00%> (+1.17%) ⬆️

... and 27 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

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.

Undefined behavior when accessing inactive union members

2 participants