-
Notifications
You must be signed in to change notification settings - Fork 437
fix: check ptr nullity before calling from_raw_parts #1213
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
Merged
Merged
+15
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ehuss
approved these changes
Feb 1, 2026
Contributor
ehuss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I pushed up a small test, too.
pbeza
added a commit
to near/mpc
that referenced
this pull request
Feb 4, 2026
Fixes: ``` [cargo-make] INFO - Execute Command: "cargo" "shear" Analyzing /home/runner/work/mpc/mpc No unused dependencies! [cargo-make] INFO - Running Task: cargo-deny [cargo-make] INFO - Execute Command: "cargo" "deny" "--all-features" "check" error[unsound]: Potential undefined behavior when dereferencing Buf struct ┌─ /home/runner/work/mpc/mpc/Cargo.lock:278:1 │ 278 │ git2 0.20.2 registry+https://github.com/rust-lang/crates.io-index │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ unsound advisory detected │ ├ ID: RUSTSEC-2026-0008 ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0008 ├ if we dereference the Buf struct right after calling new() or default() on Buf struct, it passes Null Pointer to the unsafe function slice::from_raw_parts. Based on the safety section documentation of function, data must be non-null and aligned even for zero-length slices or slices of ZSTs. Thus, passing Null Pointer will lead to undefined behavior. ├ Announcement: rust-lang/git2-rs#1213 ├ Solution: Upgrade to >=0.20.4 (try cargo update -p git2) ├ git2 v0.20.2 └── built v0.8.0 └── (build) mpc-node v3.4.0 └── backup-cli v3.4.0 advisories FAILED, bans ok, licenses ok, sources ok ```
This was referenced Feb 5, 2026
Open
Open
Open
Closed
RUSTSEC-2026-0008: Potential undefined behavior when dereferencing Buf struct
tari-project/tari#7673
Open
Closed
Closed
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1211