AlexEne / AlexEne/rust_hawktracer_sys

Functions that use raw pointers should be unsafe

Aperta
#15 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
0
Fork
4
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Functions like these are a loophole in Rust's safety:

```rust
pub fn add_cached_mapping(name: *mut i8) -> u64 {
```

```rust
add_cached_mapping(12345 as *mut i8);
```

can cause a segfault despite being "safe".

These functions should be either marked as `unsafe`, or take `CStr`, or a `&'static str` or `&'static [u8]` and checking them for `\0`.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.