id: ffi-10 original_id: P.UNS.FFI.10 level: P impact: CRITICAL Exported Rust Functions Must Be Designed for Thread-Safety Summary Functions exported to C with #[no_mangle] extern "C" may be called fro
阅读全文
Mutable Return from Immutable Parameter is Wrong
id: safety-08 original_id: P.UNS.SAS.08 level: P impact: CRITICAL clippy: mut_from_ref Mutable Return from Immutable Parameter is Wrong Summary A function taking &self or &T must not return &a
阅读全文
Be Careful with UB When Referencing #[repr(packed)] Struct Fields
id: ffi-11 original_id: P.UNS.FFI.11 level: P impact: HIGH clippy: unaligned_references Be Careful with UB When Referencing #[repr(packed)] Struct Fields Summary Creating references to fields in #[rep
阅读全文
Handle Panics When Crossing FFI Boundaries
id: ffi-04 original_id: P.UNS.FFI.04 level: P impact: CRITICAL clippy: panic_in_result_fn Handle Panics When Crossing FFI Boundaries Summary Panics must not unwind across FFI boundaries. Use catch_unw
阅读全文
Do Not Blindly Use Unsafe for Performance
id: general-02 original_id: P.UNS.02 level: P impact: CRITICAL Do Not Blindly Use Unsafe for Performance Summary Do not assume that using unsafe will automatically improve performance. Always measure
阅读全文
Use Third-Party Crates for Bitfields
id: mem-05 original_id: P.UNS.MEM.05 level: P impact: MEDIUM Use Third-Party Crates for Bitfields Summary Use crates like bitflags, bitvec, or modular-bitfield instead of manual bit manipulation for c
阅读全文
Use Portable Type Aliases from std or libc
id: ffi-05 original_id: P.UNS.FFI.05 level: P impact: HIGH Use Portable Type Aliases from std or libc Summary Use type aliases from std::os::raw or the libc crate for C-compatible types. Don't assume
阅读全文
Ensure I/O Safety When Using Raw Handles
id: io-01 original_id: P.UNS.FIO.01 level: P impact: HIGH Ensure I/O Safety When Using Raw Handles Summary When working with raw file descriptors or handles, ensure they are valid for the duration of
阅读全文
Do Not Modify Memory Variables of Other Processes or Dynamic Libraries
id: mem-02 original_id: P.UNS.MEM.02 level: P impact: CRITICAL Do Not Modify Memory Variables of Other Processes or Dynamic Libraries Summary Do not directly manipulate memory belonging to other proce
阅读全文
Provide Unsafe Counterparts for Performance Alongside Safe Methods
id: safety-07 original_id: P.UNS.SAS.07 level: P impact: MEDIUM Provide Unsafe Counterparts for Performance Alongside Safe Methods Summary When providing performance-critical operations that skip safe
阅读全文