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

validate_buffers is unsound in certain situations #69

Open
maxwellmckinnon opened this issue Oct 3, 2023 · 1 comment
Open

validate_buffers is unsound in certain situations #69

maxwellmckinnon opened this issue Oct 3, 2023 · 1 comment

Comments

@maxwellmckinnon
Copy link

In asynchro_fast.rs, validate_buffers checks the lengths of wave_in and wave_out and is subtly unsound.

as_ref and as_mut do not necessarily return pointers to the same structure every time, so the length of the objects can change between successive calls to as_mut

@HEnquist
Copy link
Owner

HEnquist commented Oct 3, 2023

The same happens in all the resamplers, not only asynchro_fast. There are multiple calls to as_ref and as_mut in the process functions. I guess the proper way to do it it to call as_ref or as_mut once at the start, and then use that result all the way through.

Has this caused any problems in practice? If not, it may not be worth doing anything about it now. I'm anyway planning to get rid of as_ref and as_mut in the (hopefully) not too distant future. The plan is to replace the current input and output buffers with something that allows abstracting the data layout, so that for example both interleaved and sequential buffers can be used.

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

2 participants