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

UB in AtomicBuffer #28

Open
dtolnay opened this issue Jan 15, 2025 · 0 comments
Open

UB in AtomicBuffer #28

dtolnay opened this issue Jan 15, 2025 · 0 comments

Comments

@dtolnay
Copy link

dtolnay commented Jan 15, 2025

A lot more of the atomic_buffer.rs API needs to be audited than what was done in closing my previous issue #16.

For example:

use aeron_rs::concurrent::atomic_buffer::AtomicBuffer;

fn main() {
    AtomicBuffer::wrap_raw_slice(&mut [] as *mut [u8; 0] as *mut [u8; 1024])
        .get_bytes(16, &mut "");
}
Segmentation fault (core dumped)

and:

use aeron_rs::concurrent::atomic_buffer::AtomicBuffer;

fn main() {
    println!("{}", AtomicBuffer::wrap_slice(&mut [1; 16]).get::<&str>(0));
}
Segmentation fault (core dumped)

and:

use aeron_rs::concurrent::atomic_buffer::AtomicBuffer;

fn main() {
    let buf = AtomicBuffer::wrap_slice(&mut [0; 16]);
    let s = buf.as_ref::<&str>(0);
    buf.set_memory(0, 16, 1);
    println!("{}", s);
}
Segmentation fault (core dumped)

From a brief skim, there are a lot more problems than just these.

XX added a commit that referenced this issue Jan 21, 2025
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

1 participant