Hi, I'm conducting a research on Rust security and found a bug in this crate:
The function Vec::from_raw_parts should not use the pointer from the FFI object, it should be a pointer allocated using the global allocator. Otherwise, it may cause a undefined behavior.
See the document for detail Vec::from_raw_parts
|
let rotations = unsafe { |
|
Vec::from_raw_parts(ptr.rotations, n_operations as usize, n_operations as usize) |
|
}; |
|
let translations = unsafe { |
|
Vec::from_raw_parts( |
|
ptr.translations, |
|
n_operations as usize, |
|
n_operations as usize, |
|
) |
|
}; |
Hi, I'm conducting a research on Rust security and found a bug in this crate:
The function
Vec::from_raw_partsshould not use the pointer from the FFI object, it should be a pointer allocated using the global allocator. Otherwise, it may cause a undefined behavior.See the document for detail Vec::from_raw_parts
spglib-rs/src/dataset.rs
Lines 98 to 107 in 0f3832a