Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Please, release a new version #7

Open
eduardosm opened this issue Jun 1, 2020 · 6 comments
Open

Please, release a new version #7

eduardosm opened this issue Jun 1, 2020 · 6 comments

Comments

@eduardosm
Copy link

The implementation of the data and data_mut functions is highly unsafe:

pub unsafe fn data<T: ?Sized>(val: *const T) -> *const () {
*mem::transmute::<*const *const T, *const *const ()>(&val)
}
/// Get the data pointer from this trait object, mutably.
///
/// Highly unsafe, as there is no information about the type of the data.
pub unsafe fn data_mut<T: ?Sized>(mut val: *mut T) -> *mut () {
*mem::transmute::<*mut *mut T, *mut *mut ()>(&mut val)
}

This assumes that the first element is a fat pointer is the data pointer. This is currently true, but it can change in a newer rust version, which would make this crate a potential security hole.

Commit 99b1993 fixed this, but it has not been released into a new version. Please, publish a new version (0.1.1) that includes this commit (and possibly yank the previous versions).

@willfindlay
Copy link

@reem This is currently the subject of a security advisory. Would you consider addressing this?

@philip-peterson
Copy link

Because it seems this repository is unmaintained, I have forked it with the submitted patches and issues merged here: https://github.com/philip-peterson/destructure_traitobject

@zonyitoo
Copy link

zonyitoo commented Jun 7, 2022

@reem Hi, would you consider make a new release for this? There are many creates depending on this.

@GuilleAmutio
Copy link

@reem Hi, would you consider make a new release for this? There are many creates depending on this.

+1

@shelvacu
Copy link

As a workaround, put this in Cargo.toml:

[patch.crates-io]
traitobject = { git = "https://github.com/reem/rust-traitobject", rev = "b3471a15917b2caf5a8b27debb0b4b390fc6634f" }

to pull in the merged-but-never-released-on-cargo fix

shelvacu added a commit to consortium-chat/plutocradroid that referenced this issue Jan 22, 2023
AAAAAAAAAAAAAAAAA

rust-lang/cargo#9227

AAAAAAAAAAAAAAAAAAAAAAAAAAAA

reem/rust-traitobject#7

AAAAAAAAAAAAAAAAAAAAA

rwf2/Rocket#1815

and updated libs and fixed deprecation warnings from chrono
@fralalonde
Copy link

fralalonde commented Mar 10, 2023

I've re-forked destructure_traitobject and made it useable for transitive patching of traitobject

Similar to @shelvacu 's previous workaround, put this in the top Cargo.toml:

[patch.crates-io]
traitobject = { git = "https://github.com/fralalonde/traitobject_patch", tag = "0.1.1" }

I'll do my best to keep it updated.

This fork also fixes warnings for Rust 2021 edition as identified in #8.

See https://github.com/fralalonde/traitobject_patch for details.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants