-
Notifications
You must be signed in to change notification settings - Fork 47
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
Fix provenance issues #100
Conversation
When creating a `BoxString` using `from_string` or `from_box_str`, `str::as_ptr` was used to get the pointer, which only has read provenance for the initialized part of the string. Going through `Vec` in the `from_string` and through `Box::into_raw` in the `from_box_str` case fixed the issue.
BoxedString
not having the right provenanceBefore, it used a zero length array to signal it being a fake DST. This is not allowed, since it doesn't allow writing past the end of this header. Rewrite the entire module to use an `ArcStringPtr` abstraction instead, which allows to easily write to the buffer and still have the header accessible.
The MSRV check fails because of
|
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 for making these changes! Just see the one comment around deleting the arc
module since it's not used anymore, after that we should be good to go!
Before, the miriflags didn't work correctly because they had a typo. Fix the typo, and also use the new strict-provenance option which implies the two used before.
The module is unused and can therefore be removed.
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 for the PR!
When creating a
BoxString
usingfrom_string
orfrom_box_str
,str::as_ptr
was used to get the pointer, which only has read provenance for the initialized part of the string. Going throughVec
in thefrom_string
and throughBox::into_raw
in thefrom_box_str
case fixed the issue.Using proper miri flags (
MIRIFLAGS=-Zmiri-strict-provenance
) miri also complains aboutrepr::arc
, which is wrong since it uses a zero length array to be a fake custom dst, which is not allowed.