Skip to content
vetkitChecksChangelogDocumentation

vetkit.rust.memory.unchecked-utf8-from-input

Bytes read from a file, socket or stream are turned into a str with from_utf8_unchecked. Invalid UTF-8 from outside the program makes this undefined behaviour.

Last updated:

Suite: Security

rust

Bytes read from a file, socket or stream are turned into a str with from_utf8_unchecked. Invalid UTF-8 from outside the program makes this undefined behaviour.

Category: SECURITY · Engine rule severity: WARNING

How to fix it

Use std::str::from_utf8 (or String::from_utf8 / from_utf8_lossy) and handle the error for external data.

References

Source: packages/engine/rules/sast/rust.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.