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

Provenance tracking issues #18

Closed
MaulingMonkey opened this issue Oct 8, 2022 · 0 comments
Closed

Provenance tracking issues #18

MaulingMonkey opened this issue Oct 8, 2022 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@MaulingMonkey
Copy link
Owner

MaulingMonkey commented Oct 8, 2022

core::ptr::from_raw_parts is not yet stable

Which is a problem for here:

b.pContext = Box::into_raw(Box::new(SourceBuffer::<Context> {
context,
audio_len: audio_data.len(),
audio_data: {
// ⚠️ WARNING: easy to muck up provenance of ArcInner<[Sample]> here.
let raw : *const [Sample] = Arc::into_raw(audio_data);
let raw : *const Sample = unsafe { (*raw).as_ptr() };
raw.cast()
},
audio_free: |data, len| {
// 🐞 BUG: core::slice::from_raw_parts here incorrectly narrows provenance from ArcInner<[Sample]> to [Sample] here.
// However, core::ptr::from_raw_parts is not yet stable: https://github.com/rust-lang/rust/issues/81513
// Local tracking issue: https://github.com/MaulingMonkey/thindx-xaudio2/issues/18
let audio_data : *const [Sample] = unsafe { core::slice::from_raw_parts(data as *const Sample, len) };
let audio_data = unsafe { Arc::from_raw(audio_data) };
drop(audio_data);
},
})).cast();

@MaulingMonkey MaulingMonkey added the bug Something isn't working label Oct 8, 2022
@MaulingMonkey MaulingMonkey added this to the 2022-10-10 milestone Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant