Skip to main content

SUSPICIOUS_RUNTIME_SYMBOL_DEFINITIONS

Static SUSPICIOUS_RUNTIME_SYMBOL_DEFINITIONS 

Source
pub static SUSPICIOUS_RUNTIME_SYMBOL_DEFINITIONS: &Lint
Expand description

The suspicious_runtime_symbol_definitions lint checks the signature of items whose symbol name is a runtime symbol expected by core.

§Example

#[unsafe(no_mangle)]
pub extern "C" fn strlen(ptr: *mut f32) -> usize { 0 }
// suspicious definition of the `strlen` function
// `ptr` should be `*const std::ffi::c_char`

{{produces}}

§Explanation

Up-most care is required when defining runtime symbols assumed and used by the standard library. They must follow the C specification, not use any standard-library facility or undefined behavior may occur.

The symbols currently checked are memcpy, memmove, memset, memcmp, bcmp and strlen.


  1. https://doc.rust-lang.org/core/index.html#how-to-use-the-core-library