Warn against passing a pointer derived from a 0 or 1 sized array to from_raw_parts #5591
Labels
A-lint
Area: New lints
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
L-correctness
Lint: Belongs in the correctness lint group
If there is a fixed size array with a length of 0 or 1, and
as_ptr()
oras_ptr_mut()
is called on that array and the result passed toslice::from_raw_parts
orslice::from_raw_parts_mut
, then emit a lint.This is almost definitely a sign of UB: rust-lang/unsafe-code-guidelines#134 (comment)
The text was updated successfully, but these errors were encountered: