Skip to content
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

AtomicBuffer still exposes UB to safe code #16

Open
dtolnay opened this issue Sep 30, 2021 · 2 comments
Open

AtomicBuffer still exposes UB to safe code #16

dtolnay opened this issue Sep 30, 2021 · 2 comments

Comments

@dtolnay
Copy link

dtolnay commented Sep 30, 2021

The repro in #14 no longer compiles on current master but the following is basically equivalent:

use aeron_rs::concurrent::atomic_buffer::{AlignedBuffer, AtomicBuffer};

fn main() {
    AtomicBuffer::from_aligned(&AlignedBuffer { ptr: 0xdeadbeefusize as _, len: 100 })
        .get_bytes(0, 0xcafebabeusize as _, 100);
}
Segmentation fault (core dumped)

In general it is unsound for a safe API to result in UB.

@denisxor
Copy link
Collaborator

In general it is unsound for a safe API to result in UB.
I fully agree with that! :-)
Can you propose the solution? May be you could do the fix and present is as PR? That will be very helpful!

@M0dEx
Copy link

M0dEx commented Jul 6, 2024

I am quite new to this codebase, but couldn't this be solved by using dest: &mut [u8] instead?

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

No branches or pull requests

3 participants