Open
Description
Line 288 in da6278f
Hello, thank you for your contribution in thin project. Currently, I'm scnning rust project in github, and I notice the following code.
pub struct HeaderView {
pub inner: *mut htslib::bcf_hdr_t,
}
fn inner(&self) -> htslib::bcf_hdr_t {
unsafe { *self.inner }
}
pub fn samples(&self) -> Vec<&[u8]> {
let names =
unsafe { slice::from_raw_parts(self.inner().samples, self.sample_count() as usize) };
names
.iter()
.map(|name| unsafe { ffi::CStr::from_ptr(*name).to_bytes() })
.collect()
}
Since samples
is a pub
function, and inner
is also a pub
field, bcf
is also a pub
mod. So I guess this might mean that the user can manipulate the value of inner
directly, and if inner
is set to an eg. null pointer
, it might cause UB.
Metadata
Metadata
Assignees
Labels
No labels