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

Clean up undefined behaviour #42

Merged
merged 1 commit into from
Sep 26, 2024
Merged

Conversation

Ryan-rsm-McKenzie
Copy link
Contributor

This pr closes #32

The issue is is that output is borrowed exclusively here:

realfft/src/lib.rs

Lines 902 to 906 in ed26ea3

let buf_out = unsafe {
let ptr = output.as_mut_ptr() as *mut Complex<T>;
let len = output.len();
std::slice::from_raw_parts_mut(ptr, len / 2)
};

But is then used again in the expression output.len() / 2 while it is still borrowed:

realfft/src/lib.rs

Lines 907 to 908 in ed26ea3

self.fft
.process_outofplace_with_scratch(&mut input[..output.len() / 2], buf_out, scratch);

@HEnquist
Copy link
Owner

Thanks for the PR! I'll make a new release as soon as I have a little time.

@HEnquist HEnquist merged commit 09b35d5 into HEnquist:master Sep 26, 2024
4 of 5 checks passed
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

Successfully merging this pull request may close these issues.

Undefined behavior
2 participants