Skip to content

Preserve Ref pointer metadata - #3626

Open
joshlf wants to merge 1 commit into
mainfrom
G6hu7kutzboxwmxwxpomxgjcpawysonqg
Open

Preserve Ref pointer metadata#3626
joshlf wants to merge 1 commit into
mainfrom
G6hu7kutzboxwmxwxpomxgjcpawysonqg

Conversation

@joshlf

@joshlf joshlf commented Sep 4, 2026

Copy link
Copy Markdown
Member

The Ref constructors that accept an explicit DST element count validated that
count, but later typed access reconstructed metadata from the byte length.
Dynamic trailing padding can make multiple element counts share one size, so
that reconstruction could produce an out-of-bounds slice.

Store the validated element count in Ref, preserve it through clone and copy,
and supply it to every typed conversion. Add regressions covering ambiguous
sizes, zero metadata, all constructor shapes, and mutable access.

Closes #3618

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.


Latest Update: v3 — Compare vs v2

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v2 v1 Base
v3 vs v2 vs v1 vs Base
v2 vs v1 vs Base
v1 vs Base
⬇️ Download this PR

Branch

git fetch origin refs/heads/G6hu7kutzboxwmxwxpomxgjcpawysonqg && git checkout -b pr-G6hu7kutzboxwmxwxpomxgjcpawysonqg FETCH_HEAD

Checkout

git fetch origin refs/heads/G6hu7kutzboxwmxwxpomxgjcpawysonqg && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/G6hu7kutzboxwmxwxpomxgjcpawysonqg && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/G6hu7kutzboxwmxwxpomxgjcpawysonqg

Stacked PRs enabled by GHerrit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-06T00:15:52.252848Z a90604a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codecov-commenter

codecov-commenter commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.97%. Comparing base (2dad389) to head (a90604a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3626      +/-   ##
==========================================
+ Coverage   91.85%   91.97%   +0.11%     
==========================================
  Files          20       20              
  Lines        6093     6142      +49     
==========================================
+ Hits         5597     5649      +52     
+ Misses        496      493       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1dec7f157b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread zerocopy/src/ref.rs Outdated
@joshlf
joshlf force-pushed the G6hu7kutzboxwmxwxpomxgjcpawysonqg branch from 1dec7f1 to 0b44b24 Compare September 4, 2026 23:40
The Ref constructors that accept an explicit DST element count validated that
count, but later typed access reconstructed metadata from the byte length.
Dynamic trailing padding can make multiple element counts share one size, so
that reconstruction could produce an out-of-bounds slice.

Store the validated element count in Ref, preserve it through clone and copy,
and supply it to every typed conversion. Add regressions covering ambiguous
sizes, zero metadata, all constructor shapes, and mutable access.

Closes #3618

*Authored by an AI agent acting on Josh Liebow-Feeser's behalf.*

gherrit-pr-id: G6hu7kutzboxwmxwxpomxgjcpawysonqg
@joshlf
joshlf force-pushed the G6hu7kutzboxwmxwxpomxgjcpawysonqg branch from 0b44b24 to a90604a Compare September 6, 2026 00:12
@joshlf

joshlf commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: a90604a6c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Correctness Advisory: Ref constructors discard explicit trailing-element counts

2 participants