rust-math / fftw

FFTW3 binding for Rust
Other
57 stars 27 forks source link

Fix unsoundness: Validate input to C2CPlan::c2c and R2RPlan::r2r #84

Closed LingMan closed 4 years ago

LingMan commented 4 years ago

The underlying C function requires that the arrays passed into it have the same length and alignment as was used to create the plan. Adding this check prevents out-of-bounds reads and possibly writes.

The same check is already in place for C2R and R2C plans.

Fixes: https://github.com/rust-math/fftw/commit/3e84ddd4f7deb583ff4ca8b47ee266576021fac5 Fixes: https://github.com/rust-math/fftw/commit/862fead9b7e815c7914acccf50106702a89beaff

LingMan commented 4 years ago

@termoshtt: The test failures are now fixed. Turns out there were two tests violating the alignment requirements which now actually get checked.

termoshtt commented 4 years ago

Thanks a lot :)